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

update on compiling with big sure and clang11: #98

Open
dokipen3d opened this issue Feb 20, 2021 · 8 comments
Open

update on compiling with big sure and clang11: #98

dokipen3d opened this issue Feb 20, 2021 · 8 comments

Comments

@dokipen3d
Copy link
Contributor

I've managed to go from clang 10 to clang 11 now. There were a few API changes in clang 11.

  • StringRefs used as return types instead of strings
  • constant/callee extraction
  • Load/Store instruction signatures changed
  • links against libxml2 so needed a few cmake tweaks
  • c++14 mode for cocl and clblast
  • Sequence type deprecated. I replaced with arrayType as that is what llvm code seems to do, but I am ignoring vectorType.
  • VectorType is now FixedVectorType and ScaleVectorType so had to add a couple of cases to a switch/case.

I know what llvm is and what it does but I've never dived into the API and nowhere near an expert (I made a toy interpreter based on craftinginterpreter.com book for fun but thats about it).

I've tested compiling a few simple example.cu files and they seem to work still.

Is anyone interested in me pushing this to a PR? I'm just messing around as I've been ill with a cold in bed and this looked like a fun project. It looks like it could still go on to do some cool things. OR we could start a new project and have it spit out spirv and use something like the vulkan kompute library instead of opencl and get this running even on macs with moltenvk. crazy I know, but would be fun!

@dokipen3d
Copy link
Contributor Author

ah there are some issues with structs as the api for inserting instructions changed, and I can't get it quite right.

@dokipen3d dokipen3d changed the title update on compiling with big sure and clang11: success update on compiling with big sure and clang11: Feb 20, 2021
@dokipen3d
Copy link
Contributor Author

actually, things aren't so successful. I'm getting nullptr returned from MDevice->getFunction(info->kernelName); in getLaunchTypes and it can't find a kernel. no idea why. Not even sure why some things were working before. I think I might have had clang 10 in my path still.

I'll pause for a while on this as I wan't to learn a bit more about llvm modules befire I hack any more. Also I want to do some cuda coding!

@dokipen3d
Copy link
Contributor Author

the struct test fails to compile on llvm 9 and above. other ones seem to work but for now, the most stable seems to be 8 (so far from the tests ive been trying out).

@hughperkins
Copy link
Owner

hughperkins commented Feb 20, 2021

"Is anyone interested in me pushing this to a PR?"

Yes please :)

(Erased my ridiculously over-long previous reply lol :) )

@dokipen3d
Copy link
Contributor Author

Thank you very much for all of the advice Hugh. Some very good points there. I myself am quite fond of nvidia and have always used their cards ( I've owned GeForce 6600 GT, 8800 GS, GTX 460, GTX 770 and now 1080 in my lifetime). I'm pursuing this mainly as a way to be able to enable small educational projects on various hardware such as lower end laptops and mini pcs. Its probably something I'l dive in and out of over months/years.

Cheers!

@dokipen3d
Copy link
Contributor Author

More thoughts on spirv. There are actually two 'dialiects' of spirv, one for opencl and one for vulkan. There is an unofficial google project clspv that translates opencl LLVM IR into vulkan SPIRV. So I'm currently looking at possible ways forward. The cool thing about vulkan spirv is that it supports subgroup operations which includes shuffle(), that you commented on in your very nice paper.

Amazingly, even the new opencl 3.0 spec does not have subgroup shuffle and is an intel extension. so if we can go from Nvidia Cuda kernel to OpenCL, we would have to delve into weird extension territory. But a route to vulkan spirv is certainly possible.

I'm currently learning about address spaces and IR which is fun. Last week I went down the Machine Learning rabbit hole and this week this. Fun times.

@hughperkins
Copy link
Owner

I've created a branch llvm-13. I just changed a few things, certainly not all, and it doesnt compile yet, and I havent tested it. Perhaps any work on making things compatible with recent-er versions of llvm can go into this branch for now?

@dokipen3d
Copy link
Contributor Author

Hi Hugh, yeah sounds good. I haven't looked too much into this recently, but if get a chance, i'll take a look :)

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

2 participants