Skip to content

[dxsa][mlir] Port LIT tests from dxilconv#196

Open
asavonic wants to merge 2 commits into
dxsa-mlirfrom
dxsa-mlir-tests-update
Open

[dxsa][mlir] Port LIT tests from dxilconv#196
asavonic wants to merge 2 commits into
dxsa-mlirfrom
dxsa-mlir-tests-update

Conversation

@asavonic

Copy link
Copy Markdown
Contributor

dxilconv tool has a LIT test suite that covers most instructions. These original tests are DXBC container binaries, but the current mlir-translate tool cannot translate from them directly - it needs only the content of SHEX section.

The tests are generated by extracting shader binaries from DXBC containers. LIT checks are auto-generated by MLIR utils/generate-test-checks.py script. The checks reflect the current state of the compiler, and it is expected they will change once we enable more instructions.

Tests in hlsl directory are from:
https://github.com/microsoft/DirectXShaderCompiler/tree/main/projects/dxilconv/test/dxbc2dxil

Tests in asm directory are from:
https://github.com/microsoft/DirectXShaderCompiler/tree/main/projects/dxilconv/test/dxbc2dxil-asm

@asavonic asavonic requested review from hvdijk and tagolog June 24, 2026 12:13
dxilconv tool has a LIT test suite that covers most instructions. These original
tests are DXBC container binaries, but the current mlir-translate tool cannot
translate from them directly - it needs only the content of SHEX section.

The tests are generated by extracting shader binaries from DXBC containers. LIT
checks are auto-generated by MLIR utils/generate-test-checks.py script. The
checks reflect the current state of the compiler, and it is expected they will
change once we enable more instructions.

Tests in hlsl directory are from:
https://github.com/microsoft/DirectXShaderCompiler/tree/main/projects/dxilconv/test/dxbc2dxil

Tests in asm directory are from:
https://github.com/microsoft/DirectXShaderCompiler/tree/main/projects/dxilconv/test/dxbc2dxil-asm
@asavonic asavonic force-pushed the dxsa-mlir-tests-update branch from 9616520 to f46e042 Compare June 24, 2026 12:34
@hvdijk

hvdijk commented Jun 24, 2026

Copy link
Copy Markdown
Contributor

Are you intending to merge this, or is this for reference? Asking because the tests all include the standard disclaimer that these tests may be bad.

If you're wanting to merge this, is there any way to change the automation to use hex and intermix the instructions with the CHECK lines, or do the tools make it too difficult to figure that out?

@tagolog

tagolog commented Jun 25, 2026

Copy link
Copy Markdown

@asavonic maybe worth to use .shex extension instead of bin to make an accent on the internal content of the file?

@asavonic

Copy link
Copy Markdown
Contributor Author

Are you intending to merge this, or is this for reference? Asking because the tests all include the standard disclaimer that these tests may be bad.

Yeah, that disclaimer is generated by utils/generate-test-checks.py. I can remove it if it is confusing.

If you're wanting to merge this, is there any way to change the automation to use hex and intermix the instructions with the CHECK lines, or do the tools make it too difficult to figure that out?

In order to intermix instructions with CHECK lines we need a custom generator - utils/generate-test-checks.py only works with MLIR. It is doable, since all instructions have a Location attribute that points back to the binary.

Let's keep these as separate binaries for now, and rename them to .shex.

@asavonic

Copy link
Copy Markdown
Contributor Author

Are you intending to merge this, or is this for reference?

Yes, I think we can merge this PR, so we don't need to cherry-pick it all the time.
Tests no longer crash, so there is no need to XFAIL them.

@hvdijk

hvdijk commented Jun 25, 2026

Copy link
Copy Markdown
Contributor

Yes, I think we can merge this PR, so we don't need to cherry-pick it all the time.
Tests no longer crash, so there is no need to XFAIL them.

They don't crash, but they don't pass. On this branch, check-mlir gives me 83 new failed tests. I'm not sure what happened, I seemed to have an outdated version of the branch and/or local changes when I initially checked. After re-checking to make sure it's clean, the tests pass.

Can you include details of how to update the tests when other PRs change how things get printed? It's not as simple as just running mlir/utils/generate-test-checks.py and give whatever test is failing as the argument.

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.

3 participants