Skip to content

Commit 1d1c0d8

Browse files
committed
add all dialects
1 parent c17e8c0 commit 1d1c0d8

File tree

4 files changed

+954
-99
lines changed

4 files changed

+954
-99
lines changed

projects/eudsl-py/CMakeLists.txt

Lines changed: 316 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -87,12 +87,276 @@ add_eudslpygen(eudslpy-gen EUDSLPY
8787
src/eudslpy-gen.cpp
8888
)
8989

90-
eudslpygen(EUDSLGenArith
91-
${MLIR_INCLUDE_DIR}/mlir/Dialect/Arith/IR/Arith.h
92-
EUDSLGenArith.cpp.inc
90+
eudslpygen(EUDSLGenacc
91+
${MLIR_INCLUDE_DIR}/mlir/InitAllDialects.h
92+
EUDSLGenacc.cpp.inc
93+
NAMESPACES mlir::acc mlir::acc::detail
94+
)
95+
96+
eudslpygen(EUDSLGenaffine
97+
${MLIR_INCLUDE_DIR}/mlir/InitAllDialects.h
98+
EUDSLGenaffine.cpp.inc
99+
NAMESPACES mlir::affine mlir::affine::detail
100+
)
101+
102+
eudslpygen(EUDSLGenamdgpu
103+
${MLIR_INCLUDE_DIR}/mlir/InitAllDialects.h
104+
EUDSLGenamdgpu.cpp.inc
105+
NAMESPACES mlir::amdgpu mlir::amdgpu::detail
106+
)
107+
108+
eudslpygen(EUDSLGenamx
109+
${MLIR_INCLUDE_DIR}/mlir/InitAllDialects.h
110+
EUDSLGenamx.cpp.inc
111+
NAMESPACES mlir::amx mlir::amx::detail
112+
)
113+
114+
eudslpygen(EUDSLGenarith
115+
${MLIR_INCLUDE_DIR}/mlir/InitAllDialects.h
116+
EUDSLGenarith.cpp.inc
93117
NAMESPACES mlir::arith mlir::arith::detail
94118
)
95119

120+
eudslpygen(EUDSLGenarm_neon
121+
${MLIR_INCLUDE_DIR}/mlir/InitAllDialects.h
122+
EUDSLGenarm_neon.cpp.inc
123+
NAMESPACES mlir::arm_neon mlir::arm_neon::detail
124+
)
125+
126+
eudslpygen(EUDSLGenarm_sme
127+
${MLIR_INCLUDE_DIR}/mlir/InitAllDialects.h
128+
EUDSLGenarm_sme.cpp.inc
129+
NAMESPACES mlir::arm_sme mlir::arm_sme::detail
130+
)
131+
132+
eudslpygen(EUDSLGenarm_sve
133+
${MLIR_INCLUDE_DIR}/mlir/InitAllDialects.h
134+
EUDSLGenarm_sve.cpp.inc
135+
NAMESPACES mlir::arm_sve mlir::arm_sve::detail
136+
)
137+
138+
eudslpygen(EUDSLGenasync
139+
${MLIR_INCLUDE_DIR}/mlir/InitAllDialects.h
140+
EUDSLGenasync.cpp.inc
141+
NAMESPACES mlir::async mlir::async::detail
142+
)
143+
144+
eudslpygen(EUDSLGenbufferization
145+
${MLIR_INCLUDE_DIR}/mlir/InitAllDialects.h
146+
EUDSLGenbufferization.cpp.inc
147+
NAMESPACES mlir::bufferization mlir::bufferization::detail
148+
)
149+
150+
eudslpygen(EUDSLGencf
151+
${MLIR_INCLUDE_DIR}/mlir/Dialect/ControlFlow/IR/ControlFlowOps.h
152+
EUDSLGencf.cpp.inc
153+
NAMESPACES mlir::cf mlir::cf::detail
154+
)
155+
156+
eudslpygen(EUDSLGencomplex
157+
${MLIR_INCLUDE_DIR}/mlir/InitAllDialects.h
158+
EUDSLGencomplex.cpp.inc
159+
NAMESPACES mlir::complex mlir::complex::detail
160+
)
161+
162+
eudslpygen(EUDSLGenDLTIDialect
163+
${MLIR_INCLUDE_DIR}/mlir/InitAllDialects.h
164+
EUDSLGenDLTIDialect.cpp.inc
165+
NAMESPACES mlir::DLTIDialect mlir::DLTIDialect::detail
166+
)
167+
168+
#eudslpygen(EUDSLGenemitc
169+
# ${MLIR_INCLUDE_DIR}/mlir/InitAllDialects.h
170+
# EUDSLGenemitc.cpp.inc
171+
# NAMESPACES mlir::emitc mlir::emitc::detail
172+
#)
173+
174+
eudslpygen(EUDSLGenfunc
175+
${MLIR_INCLUDE_DIR}/mlir/InitAllDialects.h
176+
EUDSLGenfunc.cpp.inc
177+
NAMESPACES mlir::func mlir::func::detail
178+
)
179+
180+
eudslpygen(EUDSLGengpu
181+
${MLIR_INCLUDE_DIR}/mlir/InitAllDialects.h
182+
EUDSLGengpu.cpp.inc
183+
NAMESPACES mlir::gpu mlir::gpu::detail
184+
)
185+
186+
eudslpygen(EUDSLGenindex
187+
${MLIR_INCLUDE_DIR}/mlir/Dialect/Index/IR/IndexOps.h
188+
EUDSLGenindex.cpp.inc
189+
NAMESPACES mlir::index mlir::index::detail
190+
)
191+
192+
#eudslpygen(EUDSLGenirdl
193+
# ${MLIR_INCLUDE_DIR}/mlir/InitAllDialects.h
194+
# EUDSLGenirdl.cpp.inc
195+
# NAMESPACES mlir::irdl mlir::irdl::detail
196+
#)
197+
198+
eudslpygen(EUDSLGenlinalg
199+
${MLIR_INCLUDE_DIR}/mlir/InitAllDialects.h
200+
EUDSLGenlinalg.cpp.inc
201+
NAMESPACES mlir::linalg mlir::linalg::detail
202+
)
203+
204+
#eudslpygen(EUDSLGenLLVM
205+
# ${MLIR_INCLUDE_DIR}/mlir/InitAllDialects.h
206+
# EUDSLGenLLVM.cpp.inc
207+
# NAMESPACES mlir::LLVM mlir::LLVM::detail
208+
#)
209+
210+
eudslpygen(EUDSLGenmath
211+
${MLIR_INCLUDE_DIR}/mlir/InitAllDialects.h
212+
EUDSLGenmath.cpp.inc
213+
NAMESPACES mlir::math mlir::math::detail
214+
)
215+
216+
eudslpygen(EUDSLGenmemref
217+
${MLIR_INCLUDE_DIR}/mlir/InitAllDialects.h
218+
EUDSLGenmemref.cpp.inc
219+
NAMESPACES mlir::memref mlir::memref::detail
220+
)
221+
222+
eudslpygen(EUDSLGenmesh
223+
${MLIR_INCLUDE_DIR}/mlir/Dialect/Mesh/IR/MeshOps.h
224+
EUDSLGenmesh.cpp.inc
225+
NAMESPACES mlir::mesh mlir::mesh::detail
226+
)
227+
228+
eudslpygen(EUDSLGenml_program
229+
${MLIR_INCLUDE_DIR}/mlir/InitAllDialects.h
230+
EUDSLGenml_program.cpp.inc
231+
NAMESPACES mlir::ml_program mlir::ml_program::detail
232+
)
233+
234+
eudslpygen(EUDSLGenmpi
235+
${MLIR_INCLUDE_DIR}/mlir/InitAllDialects.h
236+
EUDSLGenmpi.cpp.inc
237+
NAMESPACES mlir::mpi mlir::mpi::detail
238+
)
239+
240+
eudslpygen(EUDSLGennvgpu
241+
${MLIR_INCLUDE_DIR}/mlir/InitAllDialects.h
242+
EUDSLGennvgpu.cpp.inc
243+
NAMESPACES mlir::nvgpu mlir::nvgpu::detail
244+
)
245+
246+
eudslpygen(EUDSLGenNVVM
247+
${MLIR_INCLUDE_DIR}/mlir/InitAllDialects.h
248+
EUDSLGenNVVM.cpp.inc
249+
NAMESPACES mlir::NVVM mlir::NVVM::detail
250+
)
251+
252+
#eudslpygen(EUDSLGenomp
253+
# ${MLIR_INCLUDE_DIR}/mlir/InitAllDialects.h
254+
# EUDSLGenomp.cpp.inc
255+
# NAMESPACES mlir::omp mlir::omp::detail
256+
#)
257+
258+
eudslpygen(EUDSLGenpdl
259+
${MLIR_INCLUDE_DIR}/mlir/Dialect/PDL/IR/PDLOps.h
260+
EUDSLGenpdl.cpp.inc
261+
NAMESPACES mlir::pdl mlir::pdl::detail
262+
)
263+
264+
eudslpygen(EUDSLGenpdl_interp
265+
${MLIR_INCLUDE_DIR}/mlir/InitAllDialects.h
266+
EUDSLGenpdl_interp.cpp.inc
267+
NAMESPACES mlir::pdl_interp mlir::pdl_interp::detail
268+
)
269+
270+
eudslpygen(EUDSLGenpolynomial
271+
${MLIR_INCLUDE_DIR}/mlir/Dialect/Polynomial/IR/PolynomialOps.h
272+
EUDSLGenpolynomial.cpp.inc
273+
NAMESPACES mlir::polynomial mlir::polynomial::detail
274+
)
275+
276+
eudslpygen(EUDSLGenptr
277+
${MLIR_INCLUDE_DIR}/mlir/Dialect/Ptr/IR/PtrOps.h
278+
EUDSLGenptr.cpp.inc
279+
NAMESPACES mlir::ptr mlir::ptr::detail
280+
)
281+
282+
eudslpygen(EUDSLGenquant
283+
${MLIR_INCLUDE_DIR}/mlir/InitAllDialects.h
284+
EUDSLGenquant.cpp.inc
285+
NAMESPACES mlir::quant mlir::quant::detail
286+
)
287+
288+
eudslpygen(EUDSLGenROCDL
289+
${MLIR_INCLUDE_DIR}/mlir/InitAllDialects.h
290+
EUDSLGenROCDL.cpp.inc
291+
NAMESPACES mlir::ROCDL mlir::ROCDL::detail
292+
)
293+
294+
eudslpygen(EUDSLGenscf
295+
${MLIR_INCLUDE_DIR}/mlir/InitAllDialects.h
296+
EUDSLGenscf.cpp.inc
297+
NAMESPACES mlir::scf mlir::scf::detail
298+
)
299+
300+
eudslpygen(EUDSLGenshape
301+
${MLIR_INCLUDE_DIR}/mlir/InitAllDialects.h
302+
EUDSLGenshape.cpp.inc
303+
NAMESPACES mlir::shape mlir::shape::detail
304+
)
305+
306+
eudslpygen(EUDSLGensparse_tensor
307+
${MLIR_INCLUDE_DIR}/mlir/InitAllDialects.h
308+
EUDSLGensparse_tensor.cpp.inc
309+
NAMESPACES mlir::sparse_tensor mlir::sparse_tensor::detail
310+
)
311+
312+
eudslpygen(EUDSLGenspirv
313+
${MLIR_INCLUDE_DIR}/mlir/Dialect/SPIRV/IR/SPIRVOps.h
314+
EUDSLGenspirv.cpp.inc
315+
NAMESPACES mlir::spirv mlir::spirv::detail
316+
)
317+
318+
eudslpygen(EUDSLGentensor
319+
${MLIR_INCLUDE_DIR}/mlir/InitAllDialects.h
320+
EUDSLGentensor.cpp.inc
321+
NAMESPACES mlir::tensor mlir::tensor::detail
322+
)
323+
324+
eudslpygen(EUDSLGentosa
325+
${MLIR_INCLUDE_DIR}/mlir/InitAllDialects.h
326+
EUDSLGentosa.cpp.inc
327+
NAMESPACES mlir::tosa mlir::tosa::detail
328+
)
329+
330+
eudslpygen(EUDSLGentransform
331+
${MLIR_INCLUDE_DIR}/mlir/InitAllDialects.h
332+
EUDSLGentransform.cpp.inc
333+
NAMESPACES mlir::transform mlir::transform::detail
334+
)
335+
336+
eudslpygen(EUDSLGenub
337+
${MLIR_INCLUDE_DIR}/mlir/InitAllDialects.h
338+
EUDSLGenub.cpp.inc
339+
NAMESPACES mlir::ub mlir::ub::detail
340+
)
341+
342+
#eudslpygen(EUDSLGenvector
343+
# ${MLIR_INCLUDE_DIR}/mlir/InitAllDialects.h
344+
# EUDSLGenvector.cpp.inc
345+
# NAMESPACES mlir::vector mlir::vector::detail
346+
#)
347+
348+
eudslpygen(EUDSLGenx86vector
349+
${MLIR_INCLUDE_DIR}/mlir/InitAllDialects.h
350+
EUDSLGenx86vector.cpp.inc
351+
NAMESPACES mlir::x86vector mlir::x86vector::detail
352+
)
353+
354+
#eudslpygen(EUDSLGenxegpu
355+
# ${MLIR_INCLUDE_DIR}/mlir/InitAllDialects.h
356+
# EUDSLGenxegpu.cpp.inc
357+
# NAMESPACES mlir::xegpu mlir::xegpu::detail
358+
#)
359+
96360
execute_process(
97361
COMMAND "${Python_EXECUTABLE}" -m nanobind --cmake_dir
98362
OUTPUT_STRIP_TRAILING_WHITESPACE OUTPUT_VARIABLE nanobind_DIR)
@@ -117,6 +381,53 @@ nanobind_add_module(eudslpy_ext
117381
NB_DOMAIN eudsl
118382
src/eudslpy_ext.cpp
119383
)
384+
add_dependencies(eudslpy_ext
385+
EUDSLGenacc
386+
EUDSLGenaffine
387+
EUDSLGenamdgpu
388+
EUDSLGenamx
389+
EUDSLGenarith
390+
EUDSLGenarm_neon
391+
EUDSLGenarm_sme
392+
EUDSLGenarm_sve
393+
EUDSLGenasync
394+
EUDSLGenbufferization
395+
EUDSLGencf
396+
EUDSLGencomplex
397+
EUDSLGenDLTIDialect
398+
# EUDSLGenemitc
399+
EUDSLGenfunc
400+
EUDSLGengpu
401+
EUDSLGenindex
402+
# EUDSLGenirdl
403+
EUDSLGenlinalg
404+
# EUDSLGenLLVM
405+
EUDSLGenmath
406+
EUDSLGenmemref
407+
EUDSLGenmesh
408+
EUDSLGenml_program
409+
EUDSLGenmpi
410+
EUDSLGennvgpu
411+
EUDSLGenNVVM
412+
# EUDSLGenomp
413+
EUDSLGenpdl
414+
EUDSLGenpdl_interp
415+
EUDSLGenpolynomial
416+
EUDSLGenptr
417+
EUDSLGenquant
418+
EUDSLGenROCDL
419+
EUDSLGenscf
420+
EUDSLGenshape
421+
EUDSLGensparse_tensor
422+
EUDSLGenspirv
423+
EUDSLGentensor
424+
EUDSLGentosa
425+
EUDSLGentransform
426+
EUDSLGenub
427+
# EUDSLGenvector
428+
EUDSLGenx86vector
429+
# EUDSLGenxegpu
430+
)
120431
set_target_properties(eudslpy_ext
121432
PROPERTIES
122433
LIBRARY_OUTPUT_DIRECTORY "${EUDSLPY_SRC_DIR}/eudsl"
@@ -157,10 +468,10 @@ install(IMPORTED_RUNTIME_ARTIFACTS MLIR LLVM LIBRARY DESTINATION eudsl)
157468

158469
target_compile_options(eudslpy_ext PRIVATE ${nanobind_options})
159470
target_compile_options(nanobind-static PRIVATE ${nanobind_options})
160-
add_dependencies(eudslpy_ext EUDSLGenArith)
161471

472+
# note WORKING_DIRECTORY
162473
set(NB_STUBGEN_CMD "${Python_EXECUTABLE}" "-m" "nanobind.stubgen" --module eudslpy_ext --recursive --include-private --output-dir .)
163-
set(NB_STUBGEN_OUTPUTS "eudslpy_ext.pyi")
474+
set(NB_STUBGEN_OUTPUTS "__init__.pyi")
164475
add_custom_command(
165476
OUTPUT ${NB_STUBGEN_OUTPUTS}
166477
COMMAND ${NB_STUBGEN_CMD}

projects/eudsl-py/cmake/EUDSLPYConfig.cmake

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,10 @@ function(eudslpygen target inputFile outputFileName)
4242
set(EUDSLPYGEN_TARGET_DEFINITIONS_ABSOLUTE ${CMAKE_CURRENT_SOURCE_DIR}/${inputFile})
4343
endif()
4444

45+
if(NOT EXISTS "${EUDSLPYGEN_TARGET_DEFINITIONS_ABSOLUTE}")
46+
message(FATAL_ERROR "${inputFile} does not exist")
47+
endif()
48+
4549
# message(FATAL_ERROR "${CMAKE_CXX_COMPILER}")
4650
get_directory_property(eudslpygen_includes INCLUDE_DIRECTORIES)
4751
list(APPEND eudslpygen_includes ${CMAKE_CXX_IMPLICIT_INCLUDE_DIRECTORIES} ${ARG_EXTRA_INCLUDES})
@@ -113,10 +117,11 @@ function(eudslpygen target inputFile outputFileName)
113117
# directory and local_headers may not contain it, so we must
114118
# explicitly list it here:
115119
DEPENDS ${ARG_DEPENDS} ${eudslpygen_depends} ${local_headers} ${global_tds}
116-
COMMENT "Building ${outputFileName}..."
120+
COMMENT "EUDSLPY: Generating ${outputFileName}..."
117121
)
118122

119123
# `make clean' must remove all those generated files:
124+
# TODO(max): clean up dep files
120125
set_property(DIRECTORY APPEND PROPERTY ADDITIONAL_MAKE_CLEAN_FILES ${outputFileName})
121126
set_source_files_properties(${CMAKE_CURRENT_BINARY_DIR}/${outputFileName} PROPERTIES
122127
GENERATED 1)

0 commit comments

Comments
 (0)