Skip to content

Commit 28f1312

Browse files
committed
[Bazel] [python bindings] Bindings for vendor GPU dialects
Reviewed By: olegshyshkov Differential Revision: https://reviews.llvm.org/D157841
1 parent f450fc3 commit 28f1312

File tree

2 files changed

+212
-0
lines changed

2 files changed

+212
-0
lines changed

utils/bazel/llvm-project-overlay/mlir/BUILD.bazel

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -439,6 +439,19 @@ mlir_c_api_cc_library(
439439
],
440440
)
441441

442+
mlir_c_api_cc_library(
443+
name = "CAPIAMDGPU",
444+
srcs = ["lib/CAPI/Dialect/AMDGPU.cpp"],
445+
hdrs = ["include/mlir-c/Dialect/AMDGPU.h"],
446+
capi_deps = [
447+
":CAPIIR",
448+
],
449+
includes = ["include"],
450+
deps = [
451+
":AMDGPUDialect",
452+
],
453+
)
454+
442455
mlir_c_api_cc_library(
443456
name = "CAPIArith",
444457
srcs = ["lib/CAPI/Dialect/Arith.cpp"],
@@ -539,6 +552,32 @@ mlir_c_api_cc_library(
539552
],
540553
)
541554

555+
mlir_c_api_cc_library(
556+
name = "CAPINVGPU",
557+
srcs = ["lib/CAPI/Dialect/NVGPU.cpp"],
558+
hdrs = ["include/mlir-c/Dialect/NVGPU.h"],
559+
capi_deps = [
560+
":CAPIIR",
561+
],
562+
includes = ["include"],
563+
deps = [
564+
":NVGPUDialect",
565+
],
566+
)
567+
568+
mlir_c_api_cc_library(
569+
name = "CAPINVVM",
570+
srcs = ["lib/CAPI/Dialect/NVVM.cpp"],
571+
hdrs = ["include/mlir-c/Dialect/NVVM.h"],
572+
capi_deps = [
573+
":CAPIIR",
574+
],
575+
includes = ["include"],
576+
deps = [
577+
":NVVMDialect",
578+
],
579+
)
580+
542581
mlir_c_api_cc_library(
543582
name = "CAPIGPU",
544583
srcs = [
@@ -562,6 +601,19 @@ mlir_c_api_cc_library(
562601
],
563602
)
564603

604+
mlir_c_api_cc_library(
605+
name = "CAPIROCDL",
606+
srcs = ["lib/CAPI/Dialect/ROCDL.cpp"],
607+
hdrs = ["include/mlir-c/Dialect/ROCDL.h"],
608+
capi_deps = [
609+
":CAPIIR",
610+
],
611+
includes = ["include"],
612+
deps = [
613+
":ROCDLDialect",
614+
],
615+
)
616+
565617
mlir_c_api_cc_library(
566618
name = "CAPISCF",
567619
srcs = ["lib/CAPI/Dialect/SCF.cpp"],

utils/bazel/llvm-project-overlay/mlir/python/BUILD.bazel

Lines changed: 160 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,46 @@ filegroup(
125125
],
126126
)
127127

128+
##---------------------------------------------------------------------------##
129+
# AMDGPU dialect.
130+
##---------------------------------------------------------------------------##
131+
132+
td_library(
133+
name = "AMDGPUOpsPyTdFiles",
134+
srcs = [],
135+
includes = ["../include"],
136+
deps = [
137+
"//mlir:AMDGPUTdFiles",
138+
"//mlir:OpBaseTdFiles",
139+
],
140+
)
141+
142+
gentbl_filegroup(
143+
name = "AMDGPUOpsPyGen",
144+
tbl_outs = [
145+
(
146+
[
147+
"-gen-python-op-bindings",
148+
"-bind-dialect=amdgpu",
149+
],
150+
"mlir/dialects/_amdgpu_ops_gen.py",
151+
),
152+
],
153+
tblgen = "//mlir:mlir-tblgen",
154+
td_file = "mlir/dialects/AMDGPUOps.td",
155+
deps = [
156+
":AMDGPUOpsPyTdFiles",
157+
],
158+
)
159+
160+
filegroup(
161+
name = "AMDGPUOpsPyFiles",
162+
srcs = [
163+
"mlir/dialects/amdgpu.py",
164+
":AMDGPUOpsPyGen",
165+
],
166+
)
167+
128168
##---------------------------------------------------------------------------##
129169
# Linalg dialect.
130170
##---------------------------------------------------------------------------##
@@ -511,6 +551,126 @@ filegroup(
511551
],
512552
)
513553

554+
##---------------------------------------------------------------------------##
555+
# NVGPU dialect.
556+
##---------------------------------------------------------------------------##
557+
558+
td_library(
559+
name = "NVGPUOpsPyTdFiles",
560+
srcs = [],
561+
includes = ["../include"],
562+
deps = [
563+
"//mlir:NVGPUTdFiles",
564+
"//mlir:OpBaseTdFiles",
565+
],
566+
)
567+
568+
gentbl_filegroup(
569+
name = "NVGPUOpsPyGen",
570+
tbl_outs = [
571+
(
572+
[
573+
"-gen-python-op-bindings",
574+
"-bind-dialect=nvgpu",
575+
],
576+
"mlir/dialects/_nvgpu_ops_gen.py",
577+
),
578+
],
579+
tblgen = "//mlir:mlir-tblgen",
580+
td_file = "mlir/dialects/NVGPUOps.td",
581+
deps = [
582+
":NVGPUOpsPyTdFiles",
583+
],
584+
)
585+
586+
filegroup(
587+
name = "NVGPUOpsPyFiles",
588+
srcs = [
589+
"mlir/dialects/nvgpu.py",
590+
":NVGPUOpsPyGen",
591+
],
592+
)
593+
594+
##---------------------------------------------------------------------------##
595+
# NVVM dialect.
596+
##---------------------------------------------------------------------------##
597+
598+
td_library(
599+
name = "NVVMOpsPyTdFiles",
600+
srcs = [],
601+
includes = ["../include"],
602+
deps = [
603+
"//mlir:NVVMOpsTdFiles",
604+
"//mlir:OpBaseTdFiles",
605+
],
606+
)
607+
608+
gentbl_filegroup(
609+
name = "NVVMOpsPyGen",
610+
tbl_outs = [
611+
(
612+
[
613+
"-gen-python-op-bindings",
614+
"-bind-dialect=nvvm",
615+
],
616+
"mlir/dialects/_nvvm_ops_gen.py",
617+
),
618+
],
619+
tblgen = "//mlir:mlir-tblgen",
620+
td_file = "mlir/dialects/NVVMOps.td",
621+
deps = [
622+
":NVVMOpsPyTdFiles",
623+
],
624+
)
625+
626+
filegroup(
627+
name = "NVVMOpsPyFiles",
628+
srcs = [
629+
"mlir/dialects/nvvm.py",
630+
":NVVMOpsPyGen",
631+
],
632+
)
633+
634+
##---------------------------------------------------------------------------##
635+
# ROCDL dialect.
636+
##---------------------------------------------------------------------------##
637+
638+
td_library(
639+
name = "ROCDLOpsPyTdFiles",
640+
srcs = [],
641+
includes = ["../include"],
642+
deps = [
643+
"//mlir:OpBaseTdFiles",
644+
"//mlir:ROCDLOpsTdFiles",
645+
],
646+
)
647+
648+
gentbl_filegroup(
649+
name = "ROCDLOpsPyGen",
650+
tbl_outs = [
651+
(
652+
[
653+
"-gen-python-op-bindings",
654+
"-bind-dialect=rocdl",
655+
],
656+
"mlir/dialects/_rocdl_ops_gen.py",
657+
),
658+
],
659+
tblgen = "//mlir:mlir-tblgen",
660+
td_file = "mlir/dialects/ROCDLOps.td",
661+
deps = [
662+
":ROCDLOpsPyTdFiles",
663+
],
664+
)
665+
666+
filegroup(
667+
name = "ROCDLOpsPyFiles",
668+
srcs = [
669+
"mlir/dialects/rocdl.py",
670+
":ROCDLOpsPyGen",
671+
],
672+
)
673+
514674
##---------------------------------------------------------------------------##
515675
# SCF dialect.
516676
##---------------------------------------------------------------------------##

0 commit comments

Comments
 (0)