Rust-GPU / Rust-GPU/rust-gpu

"No OpEntryPoint instruction was found" for public function

Open
#293 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
Rust
Stars
3.4k
Forks
125
PR merge metrics
No merged PRs in 30d

Description

Expected Behaviour

Non-public submodules should be supported, but instead I'm getting this:

     Compiling ab-proof-of-space-gpu v0.1.0 (ab-proof-of-space-gpu)
  warning: function `main_cs` is never used
    --> src/shaders.rs:10:8
     |
  10 | pub fn main_cs(
     |        ^^^^^^^
     |
     = note: `#[warn(dead_code)]` on by default

  error: No OpEntryPoint instruction was found. This is only allowed if the Linkage capability is being used.
    |
    = note: module `target/debug/build/ab-proof-of-space-gpu-dc89fe269d0c81ad/out/spirv-unknown-vulkan1.1/release/deps/ab_proof_of_space_gpu.spv`

  warning: an unknown error occurred
    |
    = note: spirv-opt failed, leaving as unoptimized
    = note: module `target/debug/build/ab-proof-of-space-gpu-dc89fe269d0c81ad/out/spirv-unknown-vulkan1.1/release/deps/ab_proof_of_space_gpu.spv`

  error: error:0:0 - No OpEntryPoint instruction was found. This is only allowed if the Linkage capability is being used.
    |
    = note: spirv-val failed
    = note: module `target/debug/build/ab-proof-of-space-gpu-dc89fe269d0c81ad/out/spirv-unknown-vulkan1.1/release/deps/ab_proof_of_space_gpu.spv`

Slapping #[unsafe(no_mangle)] is sufficient to bypass this error, making submodule publicly reachable too.

I think #[spirv(..)] macro should be able to do something about it automatically to ensure it is exposed properly.

Kind of related to https://github.com/Rust-GPU/rust-gpu/issues/156

Example & Steps To Reproduce
  1. Have a shader in submodule that is not publicly reachable

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the failure with a shader function in a non-public submodule, using the reported #[spirv(..)] macro and comparing it with the #[unsafe(no_mangle)] workaround. Inspect the macro's handling of public functions and the generated SPIR-V entry points; done means the non-public submodule case validates without requiring the manual attribute.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
compilers, computer-graphics
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Needs clarification
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.