Skip to content

Comments

Add tests for read/write operations with permutation mapping#934

Merged
ftynse merged 11 commits intousers/ftynse/mappingfrom
copilot/sub-pr-931
Feb 20, 2026
Merged

Add tests for read/write operations with permutation mapping#934
ftynse merged 11 commits intousers/ftynse/mappingfrom
copilot/sub-pr-931

Conversation

Copy link
Contributor

Copilot AI commented Feb 19, 2026

  • Update tests to use 3D tensors with cyclic permutation (d0,d1,d2) -> (d1,d2,d0)
  • Use non-self-inverse permutation for more robust testing
  • Apply multi-line formatting to dictionary arguments for readability
  • Reply to formatting comment

💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI and others added 7 commits February 19, 2026 23:47
Co-authored-by: ftynse <1512299+ftynse@users.noreply.github.com>
Co-authored-by: ftynse <1512299+ftynse@users.noreply.github.com>
Co-authored-by: ftynse <1512299+ftynse@users.noreply.github.com>
Co-authored-by: ftynse <1512299+ftynse@users.noreply.github.com>
Co-authored-by: ftynse <1512299+ftynse@users.noreply.github.com>
Co-authored-by: ftynse <1512299+ftynse@users.noreply.github.com>
Co-authored-by: ftynse <1512299+ftynse@users.noreply.github.com>
Copilot AI changed the title [WIP] Add permutation mapping support for read/write operations Add tests for read/write operations with permutation mapping Feb 19, 2026
Copilot AI requested a review from ftynse February 19, 2026 23:57
@ftynse
Copy link
Contributor

ftynse commented Feb 20, 2026

Nice! Can you use higher-rank tensors so that the permutation is not equal to its inverse, this makes for a more robust test...

@ftynse
Copy link
Contributor

ftynse commented Feb 20, 2026

@copilot Nice! Can you use higher-rank tensors so that the permutation is not equal to its inverse, this makes for a more robust test...

Copilot AI and others added 2 commits February 20, 2026 09:07
Co-authored-by: ftynse <1512299+ftynse@users.noreply.github.com>
Co-authored-by: ftynse <1512299+ftynse@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Feb 20, 2026

@copilot Nice! Can you use higher-rank tensors so that the permutation is not equal to its inverse, this makes for a more robust test...

Updated both tests to use 3D tensors with a cyclic permutation (d0, d1, d2) -> (d1, d2, d0). This is a non-self-inverse permutation that requires 3 applications to return to identity, making for a more robust test.

Changes committed in 81a10e1.

@ftynse
Copy link
Contributor

ftynse commented Feb 20, 2026

@copilot the code needs a bit of reformatting, please apply the following patch:

diff --git a/lit_tests/kernel/wave/mlir_converter.py b/lit_tests/kernel/wave/mlir_converter.py
index 947d4c9..335b3fc 100644
--- a/lit_tests/kernel/wave/mlir_converter.py
+++ b/lit_tests/kernel/wave/mlir_converter.py
@@ -1111,7 +1111,11 @@ def read_with_mapping_kernel(
     k = tkw.IndexMapping.iterator(2)
     cyclic_mapping = tkw.IndexMapping(
         num_iterators=3,
-        inputs={M: k, N: i, K: j},  # Memory[M,N,K]: permutation maps (d0,d1,d2) -> (d1,d2,d0)
+        inputs={
+            M: k,
+            N: i,
+            K: j,
+        },  # Memory[M,N,K]: permutation maps (d0,d1,d2) -> (d1,d2,d0)
         outputs={N: i, K: j, M: k},  # Register[N,K,M]: N→iter(0), K→iter(1), M→iter(2)
     )
 
@@ -1188,7 +1192,11 @@ def write_with_mapping_kernel(
     cyclic_mapping = tkw.IndexMapping(
         num_iterators=3,
         inputs={N: i, K: j, M: k},  # Register[N,K,M]: N→iter(0), K→iter(1), M→iter(2)
-        outputs={M: k, N: i, K: j},  # Memory[M,N,K]: permutation maps (d0,d1,d2) -> (d1,d2,d0)
+        outputs={
+            M: k,
+            N: i,
+            K: j,
+        },  # Memory[M,N,K]: permutation maps (d0,d1,d2) -> (d1,d2,d0)
     )
 
     # Read from memory (no mapping)

Co-authored-by: ftynse <1512299+ftynse@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Feb 20, 2026

@copilot the code needs a bit of reformatting, please apply the following patch:

...

Formatting applied as requested in 112f5ed.

@ftynse ftynse marked this pull request as ready for review February 20, 2026 10:38
@ftynse ftynse merged commit 65dcf1a into users/ftynse/mapping Feb 20, 2026
2 checks passed
@ftynse ftynse deleted the copilot/sub-pr-931 branch February 20, 2026 10:38
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.

2 participants