Skip to content

Conversation

@zluda-violet
Copy link
Collaborator

Uses __ockl_bfm_u32.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This pull request implements support for the PTX bmsk.clamp.b32 instruction, which creates bit field masks with clamping behavior. The implementation uses AMD's __ockl_bfm_u32 built-in function to generate the appropriate bit masks.

Key Changes:

  • Added parser support for the bmsk.clamp.b32 instruction with proper AST representation
  • Implemented bmsk_clamp_b32 function using __ockl_bfm_u32 OCKL built-in
  • Added test case verifying clamp behavior (position=24, width=12 → 0xFF000000)

Reviewed changes

Copilot reviewed 11 out of 11 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
ptx_parser/src/lib.rs Adds parser definition for bmsk instruction with clamp mode
ptx_parser/src/ast.rs Defines Bmsk instruction AST structure and imports BmskMode type
ptx/src/test/spirv_run/mod.rs Registers new test case for bmsk_clamp_b32
ptx/src/test/spirv_run/bmsk_clamp_b32.ptx PTX test file demonstrating bmsk.clamp.b32 usage
ptx/src/test/ll/bmsk_clamp_b32.ll Expected LLVM IR output showing function call to implementation
ptx/src/pass/replace_instructions_with_functions.rs Routes Bmsk instruction to bmsk_clamp_b32 function
ptx/src/pass/llvm/emit.rs Marks Bmsk as a function-replaced instruction in LLVM emission
ptx/src/pass/instruction_mode_to_global_mode/mod.rs Excludes Bmsk from mode transformation processing
ptx/src/pass/insert_post_saturation.rs Marks Bmsk as not requiring post-saturation handling
ptx/lib/zluda_ptx_impl.cpp Implements bmsk_clamp_b32 using __ockl_bfm_u32 OCKL built-in
ptx/lib/zluda_ptx_impl.bc Updated compiled bitcode with new implementation

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

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

Successfully merging this pull request may close these issues.

1 participant