Skip to content

Add select matrix tests - #1472

Open
kmpeng wants to merge 3 commits into
llvm:mainfrom
kmpeng:select-matrix-tests
Open

Add select matrix tests#1472
kmpeng wants to merge 3 commits into
llvm:mainfrom
kmpeng:select-matrix-tests

Conversation

@kmpeng

@kmpeng kmpeng commented Aug 21, 2026

Copy link
Copy Markdown
Contributor

Closes #792.

Adds matrix tests for select testing float. Will remove the XFAIL once the Clang implementation is in.
Only testing float because select behaves the same at every element type and bit size, and we already did extensive testing on those in the scalar/vector tests.

Assisted-by: Claude Opus 4.8

Comment on lines +11 to +13
StructuredBuffer<float4> FloatCond : register(t1);
StructuredBuffer<float4> TrueVal : register(t2);
StructuredBuffer<float4> FalseVal : register(t3);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

nit:

Suggested change
StructuredBuffer<float4> FloatCond : register(t1);
StructuredBuffer<float4> TrueVal : register(t2);
StructuredBuffer<float4> FalseVal : register(t3);
StructuredBuffer<uint4> FloatCond : register(t1);
StructuredBuffer<uint4> TrueVal : register(t2);
StructuredBuffer<uint4> FalseVal : register(t3);

It might be more clear if a test fails when it is an integer as the dump of the hex representation would be clear. This is more of a thought aloud then an actual request for change

@kmpeng kmpeng Aug 24, 2026

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Hmm that's a good point, though I would have to use int4 because I set FalseVal = -TrueVal, and about half the output values are negative which are just as unreadable in hex (e.g. -35 -> 0xffffffdd). Float32s also still get a readable decimal dump, so I think I'll keep this test as float. But will definitely keep this in mind for future tests

@damyanp
damyanp requested a review from farzonl August 25, 2026 17:40
Comment thread test/Feature/HLSLLib/select_mat.test Outdated
# XFAIL: Clang

# RUN: split-file %s %t
# RUN: %dxc_target -HV 202x -T cs_6_5 -Fo %t.o %t/source.hlsl

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

why is this SM 6.5?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Oh that was just copy and pasted from other tests. I think almost all other tests (matrix or not) use 6.5 - should we normally be using 6.0 instead? But yes I'll change it.

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.

[Matrix] Add matrix test for select

3 participants