| 196 | |
| 197 | |
| 198 | def test_memory_scope_attr(): |
| 199 | from cuda_tile._mlir._mlir_libs._cuda_tile import MemoryScopeAttr |
| 200 | from cuda_tile._mlir.ir import Context, Attribute |
| 201 | |
| 202 | with Context() as ctx: |
| 203 | register_dialect(ctx, load=True) |
| 204 | # Skip parsing test as the attribute mnemonic isn't registered for parsing |
| 205 | # directly create the attribute |
| 206 | created = MemoryScopeAttr.get("tl_blk") |
| 207 | assert created.value == "tl_blk" |
| 208 | |
| 209 | # Test other memory scopes |
| 210 | device_scope = MemoryScopeAttr.get("device") |
| 211 | assert device_scope.value == "device" |
| 212 | |
| 213 | sys_scope = MemoryScopeAttr.get("sys") |
| 214 | assert sys_scope.value == "sys" |
| 215 | |
| 216 | # Test invalid memory scope |
| 217 | with pytest.raises(ValueError, match="Invalid memory scope: invalid_scope"): |
| 218 | MemoryScopeAttr.get("invalid_scope") |
| 219 | |
| 220 | |
| 221 | ############################################################################### |