Skip to content

Commit fb90385

Browse files
authored
[Instrumentation] Move instrumentation lib test to stand alone lib directory and update name (#4899)
If no install location is set, CMake by default puts all shared libraries in triton/_C. This PR moves the instrumentation test/example out of the triton install directory into it's own stand alone directory that can be populated with future development examples and gives it a more useful name.
1 parent d6dd04a commit fb90385

File tree

3 files changed

+29
-18
lines changed

3 files changed

+29
-18
lines changed

.github/workflows/integration-tests.yml

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -245,9 +245,9 @@ jobs:
245245
lit -v "${LIT_TEST_DIR}"
246246
- name: Run python tests on CUDA
247247
run: |
248-
SHARED_LIB_DIR="${GITHUB_WORKSPACE}/python/build/$(ls python/build | grep -i lib)/triton/_C"
249-
if [ ! -d "${SHARED_LIB_DIR}" ]; then
250-
echo "Coult not find '${SHARED_LIB_DIR}'" ; exit -1
248+
INSTRUMENTATION_LIB_DIR="${GITHUB_WORKSPACE}/python/build/$(ls python/build | grep -i lib)/triton/instrumentation"
249+
if [ ! -d "${INSTRUMENTATION_LIB_DIR}" ]; then
250+
echo "Coult not find '${INSTRUMENTATION_LIB_DIR}'" ; exit -1
251251
fi
252252
cd python/test/unit
253253
python3 -m pytest -s -n 8 --ignore=hopper/test_flashattention.py --ignore=language/test_line_info.py --ignore=language/test_subprocess.py --ignore=test_debug.py
@@ -257,7 +257,7 @@ jobs:
257257
TRITON_DISABLE_LINE_INFO=0 python3 -m pytest -s language/test_line_info.py
258258
# Run hopper/test_flashattention.py separately to avoid out of gpu memory
259259
python3 -m pytest -s hopper/test_flashattention.py
260-
TRITON_ALWAYS_COMPILE=1 TRITON_DISABLE_LINE_INFO=0 LLVM_PASS_PLUGIN_PATH=${SHARED_LIB_DIR}/libGPUHello.so \
260+
TRITON_ALWAYS_COMPILE=1 TRITON_DISABLE_LINE_INFO=0 LLVM_PASS_PLUGIN_PATH=${INSTRUMENTATION_LIB_DIR}/libGPUInstrumentationTestLib.so \
261261
python3 -m pytest --capture=tee-sys -rfs -vvv instrumentation/test_gpuhello.py
262262
- name: Run interpreter tests
263263
if: ${{ matrix.runner[0] == 'h100-runner-set' }}
@@ -401,9 +401,9 @@ jobs:
401401
lit -v "${LIT_TEST_DIR}"
402402
- name: Run python tests on HIP
403403
run: |
404-
SHARED_LIB_DIR="${GITHUB_WORKSPACE}/python/triton/_C"
405-
if [ ! -d "${SHARED_LIB_DIR}" ]; then
406-
echo "Coult not find '${SHARED_LIB_DIR}'" ; exit -1
404+
INSTRUMENTATION_LIB_DIR="${GITHUB_WORKSPACE}/python/triton/instrumentation"
405+
if [ ! -d "${INSTRUMENTATION_LIB_DIR}" ]; then
406+
echo "Coult not find '${INSTRUMENTATION_LIB_DIR}'" ; exit -1
407407
fi
408408
pytest --capture=tee-sys -rfs python/tutorials/06-fused-attention.py
409409
cd python/test/unit
@@ -412,7 +412,7 @@ jobs:
412412
--ignore=test_debug.py
413413
# TODO: uncomment
414414
# pytest --capture=tee-sys -rfs test_debug.py
415-
TRITON_ALWAYS_COMPILE=1 TRITON_DISABLE_LINE_INFO=0 LLVM_PASS_PLUGIN_PATH=${SHARED_LIB_DIR}/libGPUHello.so \
415+
TRITON_ALWAYS_COMPILE=1 TRITON_DISABLE_LINE_INFO=0 LLVM_PASS_PLUGIN_PATH=${INSTRUMENTATION_LIB_DIR}/libGPUInstrumentationTestLib.so \
416416
pytest --capture=tee-sys -rfs -vvv instrumentation/test_gpuhello.py
417417
418418
# Run test_line_info.py separately with TRITON_DISABLE_LINE_INFO=0

.github/workflows/integration-tests.yml.in

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -279,9 +279,9 @@ jobs:
279279

280280
- name: Run python tests on CUDA
281281
run: |
282-
SHARED_LIB_DIR="${GITHUB_WORKSPACE}/python/build/$(ls python/build | grep -i lib)/triton/_C"
283-
if [ ! -d "${SHARED_LIB_DIR}" ]; then
284-
echo "Coult not find '${SHARED_LIB_DIR}'" ; exit -1
282+
INSTRUMENTATION_LIB_DIR="${GITHUB_WORKSPACE}/python/build/$(ls python/build | grep -i lib)/triton/instrumentation"
283+
if [ ! -d "${INSTRUMENTATION_LIB_DIR}" ]; then
284+
echo "Coult not find '${INSTRUMENTATION_LIB_DIR}'" ; exit -1
285285
fi
286286
cd python/test/unit
287287
python3 -m pytest -s -n 8 --ignore=hopper/test_flashattention.py --ignore=language/test_line_info.py --ignore=language/test_subprocess.py --ignore=test_debug.py
@@ -291,7 +291,7 @@ jobs:
291291
TRITON_DISABLE_LINE_INFO=0 python3 -m pytest -s language/test_line_info.py
292292
# Run hopper/test_flashattention.py separately to avoid out of gpu memory
293293
python3 -m pytest -s hopper/test_flashattention.py
294-
TRITON_ALWAYS_COMPILE=1 TRITON_DISABLE_LINE_INFO=0 LLVM_PASS_PLUGIN_PATH=${SHARED_LIB_DIR}/libGPUHello.so \
294+
TRITON_ALWAYS_COMPILE=1 TRITON_DISABLE_LINE_INFO=0 LLVM_PASS_PLUGIN_PATH=${INSTRUMENTATION_LIB_DIR}/libGPUInstrumentationTestLib.so \
295295
python3 -m pytest --capture=tee-sys -rfs -vvv instrumentation/test_gpuhello.py
296296

297297
- name: Run interpreter tests
@@ -397,9 +397,9 @@ jobs:
397397

398398
- name: Run python tests on HIP
399399
run: |
400-
SHARED_LIB_DIR="${GITHUB_WORKSPACE}/python/triton/_C"
401-
if [ ! -d "${SHARED_LIB_DIR}" ]; then
402-
echo "Coult not find '${SHARED_LIB_DIR}'" ; exit -1
400+
INSTRUMENTATION_LIB_DIR="${GITHUB_WORKSPACE}/python/triton/instrumentation"
401+
if [ ! -d "${INSTRUMENTATION_LIB_DIR}" ]; then
402+
echo "Coult not find '${INSTRUMENTATION_LIB_DIR}'" ; exit -1
403403
fi
404404
pytest --capture=tee-sys -rfs python/tutorials/06-fused-attention.py
405405
cd python/test/unit
@@ -408,7 +408,7 @@ jobs:
408408
--ignore=test_debug.py
409409
# TODO: uncomment
410410
# pytest --capture=tee-sys -rfs test_debug.py
411-
TRITON_ALWAYS_COMPILE=1 TRITON_DISABLE_LINE_INFO=0 LLVM_PASS_PLUGIN_PATH=${SHARED_LIB_DIR}/libGPUHello.so \
411+
TRITON_ALWAYS_COMPILE=1 TRITON_DISABLE_LINE_INFO=0 LLVM_PASS_PLUGIN_PATH=${INSTRUMENTATION_LIB_DIR}/libGPUInstrumentationTestLib.so \
412412
pytest --capture=tee-sys -rfs -vvv instrumentation/test_gpuhello.py
413413

414414
# Run test_line_info.py separately with TRITON_DISABLE_LINE_INFO=0

test/lib/Instrumentation/CMakeLists.txt

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
set(GPU_INSTRUMENTATION_PASSES
2-
GPUHello
2+
GPUInstrumentationTestLib
33
)
44

5-
set(GPUHello_SOURCES
5+
set(GPUInstrumentationTestLib_SOURCES
66
GPUHello.cpp
77
)
88

@@ -20,6 +20,17 @@ foreach( plugin ${GPU_INSTRUMENTATION_PASSES} )
2020
LLVMCore
2121
"$<$<PLATFORM_ID:Darwin>:-undefined dynamic_lookup>"
2222
)
23+
# CMAKE_LIBRARY_OUTPUT_DIRECTORY is only set during the Python
24+
# build. It is empty if building directly from the root
25+
# CMakeLists.txt file. Therefore if not building from Python just
26+
# use the default CMake shared lib path otherwise this causes a hard
27+
# build error
28+
if(DEFINED CMAKE_LIBRARY_OUTPUT_DIRECTORY)
29+
set_target_properties(${plugin} PROPERTIES
30+
LIBRARY_OUTPUT_DIRECTORY
31+
"${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/../instrumentation")
32+
endif(DEFINED CMAKE_LIBRARY_OUTPUT_DIRECTORY)
33+
2334
# This is set to -fvisibility=hidden in the top level CMake file
2435
# which causes the llvmGetPassPluginInfo symbol to be hidden and
2536
# an "entry point not found" error. Reset it just for this target

0 commit comments

Comments
 (0)