Skip to content

Commit 9e1e3fc

Browse files
committed
[Clang][test] Relax checking for libclang_rt.asan.so and libclang_rt.asan_static.a on arm android. (#121361)
This fixes test breakage on clang bots. See comment llvm/llvm-project#121081 (comment)
1 parent dc70013 commit 9e1e3fc

File tree

13 files changed

+155
-6076
lines changed

13 files changed

+155
-6076
lines changed

projects/eudsl-py/CMakeLists.txt

Lines changed: 27 additions & 70 deletions
Original file line numberDiff line numberDiff line change
@@ -180,10 +180,10 @@ eudslpygen(EUDSLGenDLTIDialect
180180
NAMESPACES mlir::DLTIDialect mlir::DLTIDialect::detail
181181
)
182182

183-
#eudslpygen(EUDSLGenemitc
184-
# ${MLIR_INCLUDE_DIR}/mlir/InitAllDialects.h
185-
# NAMESPACES mlir::emitc mlir::emitc::detail
186-
#)
183+
eudslpygen(EUDSLGenemitc
184+
${MLIR_INCLUDE_DIR}/mlir/InitAllDialects.h
185+
NAMESPACES mlir::emitc mlir::emitc::detail
186+
)
187187

188188
eudslpygen(EUDSLGenfunc
189189
${MLIR_INCLUDE_DIR}/mlir/InitAllDialects.h
@@ -216,10 +216,10 @@ eudslpygen(EUDSLGenlinalg
216216
NAMESPACES mlir::linalg mlir::linalg::detail
217217
)
218218

219-
#eudslpygen(EUDSLGenLLVM
220-
# ${MLIR_INCLUDE_DIR}/mlir/InitAllDialects.h
221-
# NAMESPACES mlir::LLVM mlir::LLVM::detail
222-
#)
219+
eudslpygen(EUDSLGenLLVM
220+
${MLIR_INCLUDE_DIR}/mlir/InitAllDialects.h
221+
NAMESPACES mlir::LLVM mlir::LLVM::detail
222+
)
223223

224224
eudslpygen(EUDSLGenmath
225225
${MLIR_INCLUDE_DIR}/mlir/InitAllDialects.h
@@ -323,6 +323,7 @@ eudslpygen(EUDSLGenspirv
323323
NAMESPACES mlir::spirv mlir::spirv::detail
324324
EXTRA_INCLUDES
325325
mlir/Dialect/SPIRV/IR/SPIRVOps.h
326+
mlir/IR/PatternMatch.h
326327
)
327328

328329
eudslpygen(EUDSLGentensor
@@ -355,62 +356,17 @@ eudslpygen(EUDSLGenx86vector
355356
NAMESPACES mlir::x86vector mlir::x86vector::detail
356357
)
357358

358-
#eudslpygen(EUDSLGenxegpu
359-
# ${MLIR_INCLUDE_DIR}/mlir/InitAllDialects.h
360-
# NAMESPACES mlir::xegpu mlir::xegpu::detail
361-
#)
359+
eudslpygen(EUDSLGenxegpu
360+
${MLIR_INCLUDE_DIR}/mlir/InitAllDialects.h
361+
NAMESPACES mlir::xegpu mlir::xegpu::detail
362+
)
362363

363364
nanobind_add_module(eudslpy_ext
364365
NB_STATIC
365366
NB_DOMAIN eudsl
366367
src/eudslpy_ext.cpp
367-
${EUDSLGenacc_GENERATED_SHARDS}
368-
${EUDSLGenaffine_GENERATED_SHARDS}
369-
${EUDSLGenamdgpu_GENERATED_SHARDS}
370-
${EUDSLGenamx_GENERATED_SHARDS}
371-
${EUDSLGenarith_GENERATED_SHARDS}
372-
${EUDSLGenarm_neon_GENERATED_SHARDS}
373-
${EUDSLGenarm_sme_GENERATED_SHARDS}
374-
${EUDSLGenarm_sve_GENERATED_SHARDS}
375-
${EUDSLGenasync_GENERATED_SHARDS}
376-
${EUDSLGenbufferization_GENERATED_SHARDS}
377-
${EUDSLGencf_GENERATED_SHARDS}
378-
${EUDSLGencomplex_GENERATED_SHARDS}
379-
${EUDSLGenDLTIDialect_GENERATED_SHARDS}
380-
# ${EUDSLGenemitc_GENERATED_SHARDS}
381-
${EUDSLGenfunc_GENERATED_SHARDS}
382-
${EUDSLGengpu_GENERATED_SHARDS}
383-
${EUDSLGenindex_GENERATED_SHARDS}
384-
# ${EUDSLGenirdl_GENERATED_SHARDS}
385-
# ${EUDSLGenlinalg_GENERATED_SHARDS}
386-
# ${EUDSLGenLLVM_GENERATED_SHARDS}
387-
${EUDSLGenmath_GENERATED_SHARDS}
388-
${EUDSLGenmemref_GENERATED_SHARDS}
389-
${EUDSLGenmesh_GENERATED_SHARDS}
390-
${EUDSLGenml_program_GENERATED_SHARDS}
391-
${EUDSLGenmpi_GENERATED_SHARDS}
392-
${EUDSLGennvgpu_GENERATED_SHARDS}
393-
${EUDSLGenNVVM_GENERATED_SHARDS}
394-
# ${EUDSLGenomp_GENERATED_SHARDS}
395-
${EUDSLGenpdl_GENERATED_SHARDS}
396-
${EUDSLGenpdl_interp_GENERATED_SHARDS}
397-
${EUDSLGenpolynomial_GENERATED_SHARDS}
398-
${EUDSLGenptr_GENERATED_SHARDS}
399-
${EUDSLGenquant_GENERATED_SHARDS}
400-
${EUDSLGenROCDL_GENERATED_SHARDS}
401-
# ${EUDSLGenscf_GENERATED_SHARDS}
402-
# ${EUDSLGenshape_GENERATED_SHARDS}
403-
${EUDSLGensparse_tensor_GENERATED_SHARDS}
404-
# ${EUDSLGenspirv_GENERATED_SHARDS}
405-
${EUDSLGentensor_GENERATED_SHARDS}
406-
${EUDSLGentosa_GENERATED_SHARDS}
407-
${EUDSLGentransform_GENERATED_SHARDS}
408-
${EUDSLGenub_GENERATED_SHARDS}
409-
# ${EUDSLGenvector_GENERATED_SHARDS}
410-
${EUDSLGenx86vector_GENERATED_SHARDS}
411-
# ${EUDSLGenxegpu_GENERATED_SHARDS}
412-
)
413-
add_dependencies(eudslpy_ext
368+
)
369+
target_link_libraries(eudslpy_ext PRIVATE
414370
EUDSLGenacc
415371
EUDSLGenaffine
416372
EUDSLGenamdgpu
@@ -424,38 +380,38 @@ add_dependencies(eudslpy_ext
424380
EUDSLGencf
425381
EUDSLGencomplex
426382
EUDSLGenDLTIDialect
427-
# EUDSLGenemitc
383+
EUDSLGenemitc
428384
EUDSLGenfunc
429385
EUDSLGengpu
430386
EUDSLGenindex
431-
# EUDSLGenirdl
432-
# EUDSLGenlinalg
433-
# EUDSLGenLLVM
387+
# EUDSLGenirdl
388+
EUDSLGenlinalg
389+
EUDSLGenLLVM
434390
EUDSLGenmath
435391
EUDSLGenmemref
436392
EUDSLGenmesh
437393
EUDSLGenml_program
438394
EUDSLGenmpi
439395
EUDSLGennvgpu
440396
EUDSLGenNVVM
441-
# EUDSLGenomp
397+
# EUDSLGenomp
442398
EUDSLGenpdl
443399
EUDSLGenpdl_interp
444400
EUDSLGenpolynomial
445401
EUDSLGenptr
446402
EUDSLGenquant
447403
EUDSLGenROCDL
448-
# EUDSLGenscf
449-
# EUDSLGenshape
404+
EUDSLGenscf
405+
EUDSLGenshape
450406
EUDSLGensparse_tensor
451-
# EUDSLGenspirv
407+
EUDSLGenspirv
452408
EUDSLGentensor
453409
EUDSLGentosa
454410
EUDSLGentransform
455411
EUDSLGenub
456-
# EUDSLGenvector
412+
# EUDSLGenvector
457413
EUDSLGenx86vector
458-
# EUDSLGenxegpu
414+
EUDSLGenxegpu
459415
)
460416
set_target_properties(eudslpy_ext
461417
PROPERTIES
@@ -503,7 +459,8 @@ target_compile_options(eudslpy_ext PRIVATE ${nanobind_options})
503459
target_compile_options(nanobind-static PRIVATE ${nanobind_options})
504460

505461
# note WORKING_DIRECTORY
506-
set(NB_STUBGEN_CMD "${Python_EXECUTABLE}" "-m" "nanobind.stubgen" --module eudslpy_ext --recursive --include-private --output-dir .)
462+
set(NB_STUBGEN_CMD "${Python_EXECUTABLE}" "-m" "nanobind.stubgen"
463+
--module eudslpy_ext --recursive --include-private --output-dir .)
507464
set(NB_STUBGEN_OUTPUTS "__init__.pyi")
508465
add_custom_command(
509466
OUTPUT ${NB_STUBGEN_OUTPUTS}

projects/eudsl-py/cmake/EUDSLPYConfig.cmake

Lines changed: 30 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,5 @@
11
# copy-pasta from AddMLIR.cmake/AddLLVM.cmake/TableGen.cmake
22

3-
# Clear out any pre-existing compile_commands file before processing. This
4-
# allows for generating a clean compile_commands on each configure.
5-
file(REMOVE ${CMAKE_BINARY_DIR}/eudslpygen_compile_commands.yml)
6-
73
# no clue why but with LLVM_LINK_LLVM_DYLIB even static libs depend on LLVM
84
get_property(MLIR_ALL_LIBS GLOBAL PROPERTY MLIR_ALL_LIBS)
95
foreach(_lib ${MLIR_ALL_LIBS})
@@ -52,7 +48,7 @@ function(eudslpygen target inputFile)
5248
# Filter out empty items before prepending each entry with -I
5349
list(REMOVE_ITEM eudslpygen_includes "")
5450
list(TRANSFORM eudslpygen_includes PREPEND -I)
55-
51+
5652
set(_gen_target_dir "${CMAKE_CURRENT_BINARY_DIR}/generated/${target}")
5753
file(MAKE_DIRECTORY ${_gen_target_dir})
5854
set(fullGenFile "${_gen_target_dir}/${target}.cpp.gen")
@@ -63,12 +59,16 @@ function(eudslpygen target inputFile)
6359
# this could be smarter by asking people to list td targets or something but that's too onerous
6460
file(GLOB_RECURSE global_tds "${MLIR_INCLUDE_DIR}/mlir/*.td")
6561
# use cc -MM to collect all transitive headers
66-
set(clang_command ${CMAKE_CXX_COMPILER} -v -xc++ "-std=c++${CMAKE_CXX_STANDARD}"
62+
set(clang_command ${CMAKE_CXX_COMPILER}
63+
# -v
64+
-xc++ "-std=c++${CMAKE_CXX_STANDARD}"
6765
-MM ${EUDSLPYGEN_TARGET_DEFINITIONS_ABSOLUTE}
6866
-MT ${fullGenFile_rel}
6967
${eudslpygen_includes}
7068
-o ${_depfile})
71-
execute_process(COMMAND ${clang_command} RESULT_VARIABLE had_error COMMAND_ECHO STDERR)
69+
execute_process(COMMAND ${clang_command} RESULT_VARIABLE had_error
70+
# COMMAND_ECHO STDERR
71+
)
7272
if(had_error OR NOT EXISTS "${_depfile}")
7373
set(additional_cmdline -o "${fullGenFile_rel}")
7474
else()
@@ -126,36 +126,41 @@ function(eudslpygen target inputFile)
126126
DEPENDS ${ARG_DEPENDS} ${eudslpygen_depends} ${local_headers} ${global_tds}
127127
COMMENT "EUDSLPY: Generating ${fullGenFile}..."
128128
)
129+
# this is the specific thing connected the dependencies...
130+
set_property(DIRECTORY APPEND PROPERTY CMAKE_CONFIGURE_DEPENDS ${fullGenFile})
131+
132+
# epic hack to specify all shards that will be generated even though we don't know them before hand
133+
# TODO(max): refactor eudslpy-gen into its own subproject so that we can do execute_process(CMAKE_COMMAND... )
134+
set(_byproducts)
135+
# lol spirv has 260 ops
136+
set(_max_num_shards 30)
137+
foreach(i RANGE ${_max_num_shards})
138+
list(APPEND _byproducts "${fullGenFile}.shard.${i}.cpp")
139+
endforeach()
129140

130141
add_custom_command(OUTPUT "${fullGenFile}.sharded.cpp"
131142
COMMAND ${Python_EXECUTABLE} ${CMAKE_CURRENT_FUNCTION_LIST_DIR}/make_generated_registration.py
132143
${fullGenFile} -t ${target} -I ${ARG_EXTRA_INCLUDES} ${EUDSLPYGEN_TARGET_DEFINITIONS_ABSOLUTE}
144+
-m ${_max_num_shards}
145+
BYPRODUCTS ${_byproducts}
133146
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
134147
DEPENDS ${fullGenFile}
135148
COMMENT "EUDSLPY: Generating ${fullGenFile}.sharded.cpp..."
136149
)
137-
138-
# this is the specific thing connected the dependencies...
139150
set_property(DIRECTORY APPEND PROPERTY CMAKE_CONFIGURE_DEPENDS "${fullGenFile}.sharded.cpp")
140-
file(GLOB _generated_shards "${_gen_target_dir}/*.shard.*")
141-
list(APPEND _generated_shards "${fullGenFile}.sharded.cpp")
142-
set(${target}_GENERATED_SHARDS ${_generated_shards} PARENT_SCOPE)
151+
152+
add_library(${target} STATIC "${fullGenFile}.sharded.cpp" ${_byproducts})
153+
execute_process(
154+
COMMAND "${Python_EXECUTABLE}" -m nanobind --include_dir
155+
OUTPUT_STRIP_TRAILING_WHITESPACE OUTPUT_VARIABLE nanobind_include_dir)
156+
target_include_directories(${target} PRIVATE ${eudslpygen_includes}
157+
${Python_INCLUDE_DIRS} ${nanobind_include_dir})
143158

144159
# `make clean' must remove all those generated files:
145160
# TODO(max): clean up dep files
146-
set_property(DIRECTORY APPEND PROPERTY ADDITIONAL_MAKE_CLEAN_FILES ${fullGenFile})
147-
set_source_files_properties(${CMAKE_CURRENT_BINARY_DIR}/${fullGenFile} PROPERTIES
148-
GENERATED 1)
149-
150-
# Append the includes used for this file to the pdll_compilation_commands
151-
# file.
152-
file(APPEND ${CMAKE_BINARY_DIR}/eudslpygen_compile_commands.yml
153-
"--- !FileInfo:\n"
154-
" filepath: \"${EUDSLPYGEN_TARGET_DEFINITIONS_ABSOLUTE}\"\n"
155-
" includes: \"${CMAKE_CURRENT_SOURCE_DIR};${eudslpygen_includes}\"\n"
156-
)
157-
158-
add_public_eudslpygen_target(${target} "${fullGenFile}.sharded.cpp;${_generated_shards}")
161+
set_property(DIRECTORY ${CMAKE_CURRENT_LIST_DIR}
162+
APPEND PROPERTY ADDITIONAL_MAKE_CLEAN_FILES ${_byproducts})
163+
set_source_files_properties(${_byproducts} PROPERTIES GENERATED 1)
159164
endfunction()
160165

161166
macro(add_eudslpygen target project)

projects/eudsl-py/cmake/make_generated_registration.py

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
import argparse
22
import re
3+
import sys
34
from pathlib import Path
45
from textwrap import dedent
56

67

7-
def make_source_shards(filename: Path, target, extra_includes):
8+
def make_source_shards(filename: Path, target, extra_includes, max_num_shards):
89
assert filename.name.endswith("cpp.gen"), "expected .cpp.gen file"
910
with open(filename) as f:
1011
source = f.read()
@@ -33,6 +34,12 @@ def make_source_shards(filename: Path, target, extra_includes):
3334
print(shar, file=f)
3435
print("}", file=f)
3536

37+
if len(shards) > max_num_shards:
38+
raise RuntimeError("expected less than 20 shards")
39+
for i in range(len(shards), max_num_shards):
40+
with open(f"{filename}.shard.{i}.cpp", "w") as f:
41+
print(f"// dummy shard {i}", file=f)
42+
3643
with open(f"{filename}.sharded.cpp", "w") as f:
3744
print(
3845
dedent(
@@ -45,7 +52,10 @@ def make_source_shards(filename: Path, target, extra_includes):
4552
file=f,
4653
)
4754
for i in range(len(shards)):
48-
print(dedent(f"extern void populate{target}{i}Module(nb::module_ &m);"), file=f)
55+
print(
56+
dedent(f"extern void populate{target}{i}Module(nb::module_ &m);"),
57+
file=f,
58+
)
4959
for i in range(len(shards)):
5060
print(dedent(f"populate{target}{i}Module(m);"), file=f)
5161

@@ -57,5 +67,8 @@ def make_source_shards(filename: Path, target, extra_includes):
5767
parser.add_argument("filename")
5868
parser.add_argument("-t", "--target")
5969
parser.add_argument("-I", "--extra_includes", nargs="*")
70+
parser.add_argument("-m", "--max-num-shards", type=int, default=20)
6071
args = parser.parse_args()
61-
make_source_shards(Path(args.filename), args.target, args.extra_includes)
72+
make_source_shards(
73+
Path(args.filename), args.target, args.extra_includes, args.max_num_shards + 1
74+
)

0 commit comments

Comments
 (0)