charles-r-earp / krnl

Safe, portable, high performance compute (GPGPU) kernels.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

`krnlc --workspace` fails with `error: recompile with krnlc`

bits0rcerer opened this issue · comments

Since my last rustup update krnlc --workspace and krnlc -p … fail with error: recompile with krnlc.
Going back to the previous nightly toolchain does not help.
cargo clean or deleting the shader cache file does not help.

Any idea what I am doing wrong?

I am trying to compile: https://github.com/bits0rcerer/tsunami
kernel module: https://github.com/bits0rcerer/tsunami/blob/b918a240993a3372e1bd34f0f04ff607a6b4b5a0/epizentrum/src/frame_processing/gpu_processor.rs#L21

Yes, this is a problem. Currently working on a fix.

Essentially the caching system relied on matching on the exact tokens (actually their hash) provided to each module, in order to lookup the compiled binary, which was really neat because it errors when you make changes.

Unfortunately I think the mechanism of matching on tokens is too fragile to toolchain changes, as it has to work across stable toolchain updates, and it did, until now. Upon reflection I'm also worried that changes to macro implementations could reorder / rename, or otherwise make non breaking changes that would break because the tokens aren't the same.

So the fix is looking up the kernel by via module_path! in a const fn, which should be robust, but unfortunately will not be able to warn when you make changes, unless it changes the types of the kernel arguments. This is somewhat covered by krnlc --check, which simply recompiles and checks that the produced "krnl-cache.rs" is the same.