HVM icon indicating copy to clipboard operation
HVM copied to clipboard

Add support for MSVC and GitHub Actions

Open sepcnt opened this issue 1 year ago • 6 comments

Get run-c and run-cu works with MSVC.

  • /experimental:c11atomics and -std=c11 is 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)

sepcnt avatar May 19 '24 16:05 sepcnt

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.

kings177 avatar May 20 '24 19:05 kings177

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.

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.

sepcnt avatar May 20 '24 23:05 sepcnt

could you also remove the windows disclaimer from the README.md and add that for windows, you need MSVC ver >= 17.5 please?

kings177 avatar May 21 '24 00:05 kings177

On both windows and linux seems like it's ok, can't test on a mac right now, will try it later.

kings177 avatar May 21 '24 00:05 kings177

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

image

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

edusporto avatar May 21 '24 17:05 edusporto

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

VictorTaelin avatar May 21 '24 22:05 VictorTaelin