Skip to content

gp-sdk: fix tensor_fma unsigned operand encoding - #135

Open
AFOliveira wants to merge 1 commit into
aifoundry-org:masterfrom
AFOliveira:agent/fix-tensor-fma-unsigned-bits
Open

gp-sdk: fix tensor_fma unsigned operand encoding#135
AFOliveira wants to merge 1 commit into
aifoundry-org:masterfrom
AFOliveira:agent/fix-tensor-fma-unsigned-bits

Conversation

@AFOliveira

Copy link
Copy Markdown
Member

Fix the tensor_fma() unsigned tensor argument encoding so tenb_unsigned maps to the TensorB unsigned bit and tena_unsigned maps to the TensorA unsigned bit.

The previous helper packed those two controls in the opposite order, which made asymmetric signedness cases behave as if the A/B unsigned arguments were swapped.

Adds a focused test for the raw CSR encoding and the tensor_fma() helper contract. The launcher is added so the test can set up host/device buffers, copy probe records back, and fail on swapped raw/helper classifications.

Tested on the board and simulator.

Fixes #132

The tensor_fma helper takes unsigned controls as tenb_unsigned, tena_unsigned, but packed them into the TensorIMA8A32 CSR in the opposite order. This made asymmetric signedness cases set the A/B unsigned bits opposite to the helper contract.

Pack tenb_unsigned into UB/bit 22 and tena_unsigned into UA/bit 21, matching the PRM, simulator decode, and hardware behavior.

Add a focused GP-SDK host/device test that compares raw CSR encoding against the tensor_fma helper contract across signed/unsigned A and B combinations.

Fixes aifoundry-org#132
@AFOliveira
AFOliveira requested review from glguida and vidas July 23, 2026 15:01
@AFOliveira

Copy link
Copy Markdown
Member Author

BTW this one was fortunately not an AI jailbreak :)

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.

Bug: Tensor fma signdness - tensor a and tensor b arguments are swapped

1 participant