Skip to content

Add matrix tests for pure float->float intrinsics and scalar tests for tan() - #1471

Open
danbrown-amd wants to merge 2 commits into
llvm:mainfrom
danbrown-amd:log_mat
Open

Add matrix tests for pure float->float intrinsics and scalar tests for tan()#1471
danbrown-amd wants to merge 2 commits into
llvm:mainfrom
danbrown-amd:log_mat

Conversation

@danbrown-amd

@danbrown-amd danbrown-amd commented Aug 21, 2026

Copy link
Copy Markdown
Collaborator

Resolves #107, #787, #790, #791, #797, #800, #801, #802, #804, #805, #806, #807, #808, #809, #812, #813, #814, #819, #820, #821, #822, #823, #824, #825, #826

Assisted-by: Claude Opus 4

@@ -0,0 +1,81 @@
#--- source.hlsl

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.

Maybe we should split the tan tests into a different PR? So we can keep this PR as just matrix tests.


[numthreads(1,1,1)]
void main() {
float3x2 r32 = acos(float3x2(In[0].xy, In[0].zw, In[1].xy));

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.

(For all files)
nit: capitalize variable names

float2x4 r24 = acos(float2x4(In[1], In[2]));
float3x1 r31 = acos(float3x1(In[0].x, In[1].x, In[2].x));
float4x4 r44 = acos(float4x4(In[0], In[1], In[2], In[3]));

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.

(For all files)
There should be a constant folding case.

- Name: In
Format: Float32
Stride: 16
Data: [ -inf, -1.0, 0.0, 0.25,

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.

(General comment for all files)
We shouldn't specifically be trying to test inf/nan/denorm values unless it's a core function of the intrinsic.

Also in general, the matrix tests don't need to be very robust in the values they're testing - the scalar/vector tests should cover that.

Comment on lines +12 to +23
Out[0] = float4(r32[0], 0.0, 0.0);
Out[1] = float4(r32[1], 0.0, 0.0);
Out[2] = float4(r32[2], 0.0, 0.0);
Out[3] = r24[0];
Out[4] = r24[1];
Out[5] = float4(r31[0], 0.0, 0.0, 0.0);
Out[6] = float4(r31[1], 0.0, 0.0, 0.0);
Out[7] = float4(r31[2], 0.0, 0.0, 0.0);
Out[8] = r44[0];
Out[9] = r44[1];
Out[10] = r44[2];
Out[11] = r44[3];

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.

(For all files)
Why not pack Out like this?

  Out[0] = float4(r32[0],  r32[1]);
  Out[1] = float4(r32[2], 0.0, 0.0);
  Out[2] = r24[0];
  Out[3] = r24[1];
  Out[4] = float4(r31[0], r31[1], r31[2], 0.0);
  Out[5] = r44[0];
  Out[6] = r44[1];
  Out[7] = r44[2];
  Out[8] = r44[3];

@@ -0,0 +1,93 @@
#--- source.hlsl

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.

(Check this is true for all the intrinsics before removing anything)
I don't think we need fp16 or fp64 matrix tests for any of these intrinsics. They should all lower to a single op in DXIL/SPIRV that behave the same at every bit size, and the 32-bit matrix tests already exercise them. 16-bit/64-bit coverage is handled in the scalar/vector tests, so I don't think we need matrix ones.

Comment on lines +36 to +39
Data: [ -1.0, -0.86603,-0.70711,-0.5,
0.0, 0.5, 0.70711, 0.86603,
1.0, -0.5, 0.70711,-0.86603,
-0.86603, 0.86603, -0.5, -0.70711 ]

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.

Lots of weird formatting throughout the files (e.g. here).

Comment on lines +65 to +66
Rule: BufferFloatULP
ULPT: 0

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.

You can just make this BufferExact.

@kmpeng kmpeng left a comment

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.

All your tests are failing - you need to XFAIL: Clang them since the matrix implementations aren't in.

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.

Add test for tan

2 participants