Skip to content

Add matrix tests for pure float->float intrinsics - #1471

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

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 #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

Comment thread test/Feature/HLSLLib/tan.16.test
Comment thread test/Feature/HLSLLib/acos_mat.32.test Outdated
Comment thread test/Feature/HLSLLib/acos_mat.32.test Outdated
Comment thread test/Feature/HLSLLib/saturate_mat.32.test Outdated
Comment thread test/Feature/HLSLLib/acos_mat.32.test Outdated
Comment thread test/Feature/HLSLLib/acos_mat.fp16.test Outdated
Comment thread test/Feature/HLSLLib/acos_mat.32.test Outdated
Comment thread test/Feature/HLSLLib/saturate_mat.32.test Outdated

@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.

@danbrown-amd danbrown-amd changed the title Add matrix tests for pure float->float intrinsics and scalar tests for tan() Add matrix tests for pure float->float intrinsics Aug 29, 2026
@danbrown-amd
danbrown-amd force-pushed the log_mat branch 4 times, most recently from 4fde249 to 3f1828a Compare September 3, 2026 17:33
Comment on lines +7 to +11
float3x2 R32 = acos(float3x2(In[0].xy, In[0].zw, In[1].xy));
float2x4 R24 = acos(float2x4(In[1], In[2]));
float3x1 R31 = acos(float3x1(In[4].xyz));
float4x4 R44 = acos(float4x4(In[5], In[6], In[7], In[8]));
float2x2 R22 = acos(float2x2(-1.0, -0.5, 0.5, 1.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.

(For all files)
The In indexing is confusing/hard to follow. For example, In[3] is completely skipped. In[3] and In[4].w are also populated with real values but never used.
I would rather we follow the same format as already merged matrix tests.

Comment on lines +40 to +43
-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.

(For all files)
Seems your In[5]-In[8] values are just exact duplicates of In[0]-In[3]. Can we test some new values? Or if you don't think that's necessary, let's at least reuse In[0]-In[3] so we don't have to allocate space for repeat values.

Comment on lines +44 to +48
# 3x2: -1, -sqrt(3)/2, -1/sqrt(2), -0.5, 0, 0.5, _, _
# 2x4: 0, 0.5, 1/sqrt(2), sqrt(3)/2, 1, -0.5, 1/sqrt(2), -sqrt(3)/2
# 3x1: -1, -0.5, 0.5, _
# 4x4: -1, -sqrt(3)/2, -1/sqrt(2), -0.5, 0, 0.5, 1/sqrt(2), sqrt(3)/2,
# 1, -0.5, 1/sqrt(2), -sqrt(3)/2, -sqrt(3)/2, sqrt(3)/2, -0.5, -1/sqrt(2)

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 that comment on buffer values)
This comment format doesn't feel very useful for In. I would rather we use the format other matrix tests have used for the In buffers.

0.0, 2.0944, 0.7854, 2.61799,
2.61799, 0.5236, 2.0944, 2.35619,
3.14159, 2.0944, 1.0472, 0.0 ]
Results:

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 that comment on buffer values)
No comment on output buffer values?

- Name: In
Format: Float32
Stride: 16
Data: [ -89.0, -2.0, -1.0, 0.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.

Doesn't exp(-89) = a denormal?

Results:
- Result: Test1
Rule: BufferFloatEpsilon
Epsilon: 0.0008

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.

This uses Epsilon: 0.0008 but its vector/scalar test + all sqrt tests use ULP: 1. It would be good to be consistent.

0.0, 0.5, 0.75, 1.0 ]
Results:
- Result: Test1
Rule: BufferExact

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.

Sorry I said this could be changed to BufferExact, but I think we should leave it as Epsilon: 0 to keep it consistent with similar tests. BufferExact also handles some values differently from Epsilon: 0, which shouldn't matter here currently but may in the future.

Comment on lines +44 to +48
# 3x2: 0, 1/16, 1/4, 1, 2, 4, _, _
# 2x4: 2, 4, 9, 16, 100, 1, 4, 1/16
# 3x1: 1, 4, 9, _
# 4x4: 0, 1/16, 1/4, 1, 2, 4, 9, 16,
# 100, 1, 4, 1/16, 1/16, 1/4, 9, 16

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.

This doesn't seem necessary

@kmpeng

kmpeng commented Sep 11, 2026

Copy link
Copy Markdown
Contributor

llvm/llvm-project#220723 was fixed so you can remove those XFAILs

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

3 participants