Add support for MSVC and GitHub Actions
Get run-c and run-cu works with MSVC.
-
/experimental:c11atomicsand-std=c11is required for stdatomic - Extremely large array (>=2GB) is not allowed on Windows so we have to use a pointer instead
- CUDA also needs some work for allocation
- threads.h rather than pthreads.h for compatibility.
- time64() with QueryPerformanceCounter()
Add GitHub Actions CI for building and linting.
(This is a clean PR from https://github.com/HigherOrderCO/HVM/pull/294)
Rust and CU version works fine, C doesn't, might be because of the experimental:c11atomics not being fully supported by MSVC?
pasting the error for better reference:
WARNING: Failed to compile hvm.c: ToolExecError: Command "C:\\Program Files\\Microsoft Visual Studio\\2022\\Community\\VC\\Tools\\MSVC\\14.38.33130\\bin\\HostX64\\x64\\cl.exe" "-nologo" "-MD" "-O2" "-Brepro" "-std:c11" "/experimental:c11atomics" "-DTPC_L2=4" "-FoC:\\Users\\yanki\\hvm\\target\\release\\build\\hvm-fee5e6bdbeba46c9\\out\\2e40c9e35e9506f4-hvm.o" "-c" "src/hvm.c" with args cl.exe did not execute successfully (status code exit code: 2).
warning: [email protected]: Ignoring hvm.c and proceeding with build. The C runtime will not be available.
Rust and CU version works fine, C doesn't, might be because of the
experimental:c11atomicsnot being fully supported by MSVC?pasting the error for better reference:
WARNING: Failed to compile hvm.c: ToolExecError: Command "C:\\Program Files\\Microsoft Visual Studio\\2022\\Community\\VC\\Tools\\MSVC\\14.38.33130\\bin\\HostX64\\x64\\cl.exe" "-nologo" "-MD" "-O2" "-Brepro" "-std:c11" "/experimental:c11atomics" "-DTPC_L2=4" "-FoC:\\Users\\yanki\\hvm\\target\\release\\build\\hvm-fee5e6bdbeba46c9\\out\\2e40c9e35e9506f4-hvm.o" "-c" "src/hvm.c" with args cl.exe did not execute successfully (status code exit code: 2). warning: [email protected]: Ignoring hvm.c and proceeding with build. The C runtime will not be available.
Yes you will need at least msvc 17.5. Otherwise a larger polyfill for atomic will be required. You can check the action on the fork to view successful build configuration of all platforms.
could you also remove the windows disclaimer from the README.md and add that for windows, you need MSVC ver >= 17.5 please?
On both windows and linux seems like it's ok, can't test on a mac right now, will try it later.
Tested on MacOS, all examples in examples get the same results but it seems slightly slower, could be statistically insignificant since I only ran each test once
We're still discussing a few things internally before merging, specially the changes to Net allocation
We're also still developing automated tests so it gets easier to compare such changes
Thanks for the PR! I really appreciate it. It changes some things I'm not aware will be safe though. I'll go through it later, when we have more tests