Rust-GPU / Rust-GPU/rust-gpu

"No OpEntryPoint instruction was found" for public function

Đang mở
#293 4 bình luận 0 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

bug
Ngôn ngữ chính
Rust
Star
3.4k
Fork
126
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Mô tả

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

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Hướng nghiên cứu

Tái hiện lỗi với một hàm shader trong một submodule không công khai, sử dụng macro #[spirv(..)] đã được báo cáo và so sánh với workaround #[unsafe(no_mangle)]. Kiểm tra cách macro xử lý các hàm công khai và các entry point SPIR-V được tạo; được coi là hoàn thành khi trường hợp submodule không công khai được xác thực mà không yêu cầu thuộc tính thủ công.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Đánh giá

Công nghệ
rust
Lĩnh vực
compilers, computer-graphics
Loại issue
Lỗi
Độ khó
4/5
Thời gian dự kiến
3-5 ngày
Mức độ hoạt động
Ít trao đổi
Độ rõ ràng
Cần làm rõ
Mức phù hợp với người mới
42/100

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.