shader-slang / slang-torch

A Python package for calling Slang modules from PyTorch.
Other
38 stars 8 forks source link

Slang and PyTorch setup documentation #10

Open randallrvr opened 5 months ago

randallrvr commented 5 months ago

There desperately needs to be some documentation on setting up a working slangtorch environment with CUDA and pytorch that is a bit more detailed than "pip install slangtorch"

4ri4Slr commented 1 day ago

Yeah I'm able to install using "pip install slangtorch" but the unit tests fail. It would be nice to get more clarification. I am using CUDA 11.8, and PyTorch 2.4. I get the following error: fatal error C1083: Cannot open include file: 'slang.h': No such file or directory ninja: build stopped: subcommand failed.

oliver-batchelor commented 1 day ago

https://github.com/shader-slang/slang-torch/issues/24 I guess is a duplicate!

oliver-batchelor commented 1 day ago

@randallrvr Did you figure out any workaround for how to install in an environment (or any hack to make it work)?

oliver-batchelor commented 23 hours ago

Ok I had some success, looking around I couldn't find any slang.h on my system, so I figured maybe it also needs a base slang install - which is the case.

I did two things:

Presumably, this also works if you install it in your system the same way, but I'd rather not unpack tar files in my system folders outside the package manager.

4ri4Slr commented 23 hours ago

@oliver-batchelor I took the slang.h from https://github.com/shader-slang/slang/blob/master/include/slang.h and copied it to my CUDA include path and it resolved the problem.

oliver-batchelor commented 21 hours ago

@4ri4Slr Thanks.

I guess question is where is slang.h meant to come from, is slangtorch meant to be standalone? Maybe @saipraveenb25 saipraveenb25 can answer this?

saipraveenb25 commented 11 hours ago

The slang.h problem stems from an issue with the main slang code-base. The main code-base has an embedding tool that 'inlines' all slang-related header files into a single string and embeds that into the slang binary.

Normally, there should not be any slang-related #include directives in the generated code. However, the embedding tool broke and failed to inline everything. Since we're still in the process of setting up proper CI between slangtorch & slang, this caused the v1.3.1 release to break. We fixed this here: https://github.com/shader-slang/slang/pull/5680

Could you try again with the new slangtorch release v1.3.2 which includes this fix?