HVM icon indicating copy to clipboard operation
HVM copied to clipboard

Failed to parse result from HVM.

Open TheSimicSlaw opened this issue 1 year ago • 10 comments

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

TheSimicSlaw avatar Jun 05 '24 02:06 TheSimicSlaw

Was this today? I wonder if the temporary stack size increase I pushed yesterday (https://github.com/HigherOrderCO/HVM/commit/b338dbd317db7756945a0aa3823fc2cb2eec91fd) 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?

VictorTaelin avatar Jun 05 '24 13:06 VictorTaelin

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

edusporto avatar Jun 05 '24 15:06 edusporto

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.

VictorTaelin avatar Jun 05 '24 18:06 VictorTaelin

@edusporto or @enricozb any updates?

TheSimicSlaw avatar Jun 11 '24 19:06 TheSimicSlaw

@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.

enricozb avatar Jun 24 '24 05:06 enricozb

@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.

TheSimicSlaw avatar Jul 26 '24 15:07 TheSimicSlaw

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 avatar Aug 18 '24 17:08 sinsikyan

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

sinsikyan avatar Aug 18 '24 17:08 sinsikyan

@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 avatar Aug 18 '24 17:08 developedby

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

cargo install --path .

developedby avatar Aug 18 '24 17:08 developedby