Skip to content

Commit

Permalink
fix parsing instances for pt inductor
Browse files Browse the repository at this point in the history
add unit test for gen instances for gemms

add unit tests for conv and batched gemms

add unit test for preselected gemm instances

apply ruff lint

add license header for the unit test

add inductor pytest to CI

verbose pip install

switch the directory before installing python packages

move the inductor codegen test

try yet another workdir

Update Jenkinsfile

The directory looks right, fixing pip module not found by invoking pip directly

Update Jenkinsfile

invoke pytest directly since the module is not found

Update Dockerfile

Install setuptools

update package structure

bump setuptools

maybe fix data path for library sources

fix library search path for conv instances

fix path in pyproject definition

compare path used in gen_instances with one in pyproject.toml; fix the difference
  • Loading branch information
tenpercent committed Jan 11, 2025
1 parent fd46a01 commit 314d924
Show file tree
Hide file tree
Showing 5 changed files with 66 additions and 9 deletions.
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ RUN pip install --upgrade cmake==3.27.5 && \
dpkg -i dumb-init_*.deb && rm dumb-init_*.deb && \
# Install packages for processing the performance results
pip3 install --upgrade pip && \
pip3 install sqlalchemy==2.0.36 pymysql pandas==2.2.3 setuptools-rust sshtunnel==0.4.0 && \
pip3 install --upgrade pytest sqlalchemy==2.0.36 pymysql pandas==2.2.3 setuptools-rust setuptools>=75 sshtunnel==0.4.0 && \
# Add render group
groupadd -f render && \
# Install the new rocm-cmake version
Expand Down
7 changes: 7 additions & 0 deletions Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -512,6 +512,13 @@ def Build_CK(Map conf=[:]){
arch_type = 5
}
cmake_build(conf)
if ( arch_type == 1 ){
echo "Run inductor codegen tests"
sh """
pip install --verbose .
pytest python/test/test_gen_instances.py
"""
}
dir("build"){
if (params.RUN_FULL_QA && arch_type == 1 ){
// build deb packages for all gfx9 targets on gfx90a system and prepare to export
Expand Down
7 changes: 5 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,16 +21,19 @@ dependencies = []
"Bug Tracker" = "https://github.com/rocm/composable_kernel/issues"

[tool.setuptools]
packages = ["ck4inductor", "ck4inductor.include", "ck4inductor.library"]
packages = ["ck4inductor", "ck4inductor.include", "ck4inductor.library", "ck4inductor.universal_gemm", "ck4inductor.batched_universal_gemm", "ck4inductor.grouped_conv_fwd"]

[tool.setuptools.package-dir]
ck4inductor = "python/ck4inductor"
"ck4inductor.universal_gemm" = "python/ck4inductor/universal_gemm"
"ck4inductor.batched_universal_gemm" = "python/ck4inductor/batched_universal_gemm"
"ck4inductor.grouped_conv_fwd" = "python/ck4inductor/grouped_conv_fwd"
"ck4inductor.include" = "include"
"ck4inductor.library" = "library"

[tool.setuptools.package-data]
"ck4inductor.include" = ["ck/**/*.hpp"]
"ck4inductor.library" = ["src/tensor_operation_instance/gpu/gemm_universal/**/*.hpp"]
"ck4inductor.library" = ["src/tensor_operation_instance/gpu/gemm_universal/**/*.hpp", "src/tensor_operation_instance/gpu/gemm_universal_batched/**/*.hpp", "include/ck/library/tensor_operation_instance/gpu/grouped_conv_fwd/**/*.hpp"]

[tool.setuptools.dynamic]
version = { attr = "setuptools_scm.get_version" }
13 changes: 7 additions & 6 deletions python/ck4inductor/universal_gemm/gen_instances.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,12 +68,13 @@ def maybe_int(s):

template_args.insert(2, tuple()) # ds layout
template_args.insert(6, tuple()) # ds dtype

new_instance = CKGemmOperation(
*template_args, # type: ignore[arg-type]
)

op_instances.append(new_instance)
try:
new_instance = CKGemmOperation(
*template_args, # type: ignore[arg-type]
)
op_instances.append(new_instance)
except TypeError as e:
log.debug(f"{e} when parsing {line}")
return op_instances


Expand Down
46 changes: 46 additions & 0 deletions python/test/test_gen_instances.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# SPDX-License-Identifier: MIT
# Copyright (c) 2018-2025, Advanced Micro Devices, Inc. All rights reserved.
import logging

import unittest

from ck4inductor.universal_gemm.gen_instances import (
gen_ops_library as gen_gemm_ops_library,
)
from ck4inductor.universal_gemm.gen_instances import (
gen_ops_preselected as gen_gemm_ops_preselected,
)
from ck4inductor.grouped_conv_fwd.gen_instances import (
gen_conv_ops_library as gen_conv_ops_library,
)
from ck4inductor.batched_universal_gemm.gen_instances import (
gen_ops_library as gen_batched_gemm_ops_library,
)

log = logging.getLogger(__name__)


class TestGenInstances(unittest.TestCase):
def test_gen_gemm_instances(self):
instances = gen_gemm_ops_library()

log.debug("%d gemm instances from library" % len(instances))
self.assertTrue(instances)

def test_preselected_gemm_instances(self):
instances = gen_gemm_ops_preselected()

log.debug("%d preselected gemm instances" % len(instances))
self.assertTrue(instances)

def test_gen_conv_instances(self):
instances = gen_conv_ops_library()

log.debug("%d gemm instances from library" % len(instances))
self.assertTrue(instances)

def test_gen_batched_gemm_instances(self):
instances = gen_batched_gemm_ops_library()

log.debug("%d gemm instances from library" % len(instances))
self.assertTrue(instances)

0 comments on commit 314d924

Please sign in to comment.