Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Failed to parse result from HVM. #372

Open
TheSimicSlaw opened this issue Jun 5, 2024 · 10 comments
Open

Failed to parse result from HVM. #372

TheSimicSlaw opened this issue Jun 5, 2024 · 10 comments
Assignees

Comments

@TheSimicSlaw
Copy link

Reproducing the behavior

I don't have an NVIDIA gpu yet, so I'm currently working with run and run-c.
I'm trying to learn by doing different examples, but I'm running into an issue where sometimes when I try to run a program, it gives me a "Failed to parse result from HVM." error. This always happens when I try to use run-c and sometimes when I try the regular run, such as the sorting tree rotation example you gave in https://gist.github.com/VictorTaelin/face210ca4bc30d96b2d5980278d3921 (which I copied word-for-word to avoid errors while I figure it out).
I'm not entirely sure what is going wrong. I successfully installed HVM and most of my programs are working with a regular run command.

System Settings

OS: WSL Ubuntu 22.04.3 LTS
CPU: AMD Ryzen 7 Microsoft Surface (R) Edition, 2000 Mhz, 8 Core(s), 16 Logical Processor(s)

Additional context

No response

@VictorTaelin
Copy link
Member

Was this today? I wonder if the temporary stack size increase I pushed yesterday (b338dbd) broke it in some computers.

@TheSimicSlaw can you please edit the generated hvm.c to use a smaller stack size? Like this:

hvm gen-c main.hvm > main.c

# edit 'main.c' to replace 'Port stack[4096];' by 'Port stack[256];'

gcc main.c -o main
./main

@edusporto can you please fully investigate this issue yourself? If the stack size is too large, decrease it to the largest reasonable amount. We should get rid of it when we're able to readback from C/CUDA properly. How's that work going?

@edusporto edusporto self-assigned this Jun 5, 2024
@edusporto
Copy link
Contributor

edusporto commented Jun 5, 2024

The issue seems a bit deeper than that. Both when setting that stack to size 4096 and 256, running the program will sometimes return a valid result and sometimes an invalid one.

➜  /tmp bend gen-hvm test.bend > test.hvm
➜  /tmp hvm gen-c test.hvm > test.c
➜  /tmp gcc -O2 test.c -o test
➜  /tmp ./test
Result: 16252928
- ITRS: 6105333733
- TIME: 22.13s
- MIPS: 275.93
➜  /tmp ./test
Result: x1fffffff
- ITRS: 5849001015
- TIME: 26.26s
- MIPS: 222.78

This seems like it will be tricky to diagnose, I'll look into it after finishing #362

@VictorTaelin
Copy link
Member

Oh I thought my commit broke it. Well, this was working fine in the past. It just stopped working?

In this case, @enricozb, can you find which commit broke it? Maximum priority here.

@edusporto edusporto removed their assignment Jun 6, 2024
@TheSimicSlaw
Copy link
Author

@edusporto or @enricozb any updates?

@enricozb enricozb self-assigned this Jun 17, 2024
@enricozb
Copy link
Contributor

@TheSimicSlaw Can you try again on the latest version, we've fixed a handful of bugs which might have included this issue. If not, please send an offending .hvm file so we can reproduce.

@TheSimicSlaw
Copy link
Author

TheSimicSlaw commented Jul 26, 2024

@enricozb It has not, unfortunately, been fixed. GitHub says it doesn't support the file type to link the .hvm file. How would you like me to send it to you?

p.s. Sorry for the delayed response! A lot of stuff's gone down and I'm only now getting back to this.

@sinsikyan
Copy link

I also have this issue.

OS: ubuntu on WSL2 on win11
GPU: nividia geforece 940MX

hvm 2.0.22
bend-lang 0.2.36

nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2023 NVIDIA Corporation
Built on Fri_Jan__6_16:45:21_PST_2023
Cuda compilation tools, release 12.0, V12.0.140
Build cuda_12.0.r12.0/compiler.32267302_0

gcc (Ubuntu 12.3.0-17ubuntu1) 12.3.0

g++ (Ubuntu 12.3.0-17ubuntu1) 12.3.0

@sinsikyan
Copy link

Also, how can I install from git, I only knows how to install through rust crate

@developedby
Copy link
Member

developedby commented Aug 18, 2024

@enricozb It has not, unfortunately, been fixed. GitHub says it doesn't support the file type to link the .hvm file. How would you like me to send it to you?

p.s. Sorry for the delayed response! A lot of stuff's gone down and I'm only now getting back to this.

You can make it into a gist (https://gist.github.com/) and then post the link here. Also, that's the message that bend gives, HVM is probably just crashing.
You can try first compiling the program to HVM or to CUDA and then running that (bend gen-cu <file> > my_program.cu). That'll probably give a better error message.

@developedby
Copy link
Member

Also, how can I install from git, I only knows how to install through rust crate

cargo install --path .

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants