Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
OpenDAS
tilelang
Commits
5c62d00a
Unverified
Commit
5c62d00a
authored
Nov 01, 2025
by
Zhengju Tang
Committed by
GitHub
Nov 01, 2025
Browse files
[Testing] Move TMA 1D and test for its functionality (#1167)
* [Testing] Move TMA 1D and test for its functionality * [Lint]
parent
54d4bd62
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
16 deletions
+16
-16
examples/elementwise/test_example_elementwise.py
examples/elementwise/test_example_elementwise.py
+0
-5
testing/python/language/test_tilelang_language_tma_1d.py
testing/python/language/test_tilelang_language_tma_1d.py
+16
-11
No files found.
examples/elementwise/test_example_elementwise.py
View file @
5c62d00a
import
tilelang.testing
import
example_elementwise_add
import
example_elementwise_add_tma_1d
def
test_example_elementwise_add
():
example_elementwise_add
.
main
()
def
test_example_elementwise_add_tma_1d
():
example_elementwise_add_tma_1d
.
main
()
if
__name__
==
"__main__"
:
tilelang
.
testing
.
main
()
examples/elementwise/example_elementwise_add
_tma_1d.py
→
testing/python/language/test_tilelang_language
_tma_1d.py
View file @
5c62d00a
import
argparse
import
torch
import
tilelang
import
tilelang.language
as
T
import
torch
def
ref_program
(
x
,
y
):
...
...
@@ -30,23 +29,29 @@ def elementwise_add(M, N, block_M, block_N, in_dtype, out_dtype, threads):
return
elem_add
def
main
():
parser
=
argparse
.
ArgumentParser
()
parser
.
add_argument
(
"--m"
,
type
=
int
,
default
=
128
)
parser
.
add_argument
(
"--n"
,
type
=
int
,
default
=
128
)
args
,
_
=
parser
.
parse_known_args
()
M
,
N
=
args
.
m
,
args
.
n
def
run_elementwise_add
(
M
,
N
):
a
=
torch
.
randn
(
M
,
N
,
dtype
=
torch
.
float32
,
device
=
"cuda"
)
b
=
torch
.
randn
(
M
,
N
,
dtype
=
torch
.
float32
,
device
=
"cuda"
)
# Default config
config
=
{
"block_M"
:
128
,
"block_N"
:
128
,
"threads"
:
128
}
block_M
,
block_N
=
128
,
128
config
=
{
"block_M"
:
block_M
,
"block_N"
:
block_N
,
"threads"
:
128
}
kernel
=
elementwise_add
(
M
,
N
,
**
config
,
in_dtype
=
"float32"
,
out_dtype
=
"float32"
)
out
=
kernel
(
a
,
b
)
torch
.
testing
.
assert_close
(
out
,
ref_program
(
a
,
b
),
rtol
=
1e-2
,
atol
=
1e-2
)
print
(
"All passed!"
)
code
=
kernel
.
get_kernel_source
()
if
block_N
==
N
:
assert
"tma_load"
in
code
and
"CUtensorMap"
not
in
code
else
:
assert
"tma_load"
in
code
and
"CUtensorMap"
in
code
def
main
():
run_elementwise_add
(
128
,
128
)
run_elementwise_add
(
256
,
128
)
run_elementwise_add
(
256
,
256
)
if
__name__
==
"__main__"
:
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment