Conversation
marbre
left a comment
There was a problem hiding this comment.
I am not familiar with HeCBench but I see several major issues here. Leaving some comments as I was asked to but it requires a more careful evaluation of those familiar with the project.
In addition to my other comments my main concern is about Makefile patching. Each benchmark is added via add_subdirectory and has it's own CMakeLists.txt. CMake generates a proper target and never invokes the manually written Makefile. Thus patching those Makefiles accomplished nothing for the CMake build as Makefiles get generated via CMake (if not using Ninja).
I think you rather want to use the CMake based build and there may be adjustments needed, but the Makefile patching isn't part of this.
src/CMakeLists.txt
Outdated
| # Parse user-provided skip list once and reuse during benchmark discovery. | ||
| set(_hecbench_skip_benchmarks "${HECBENCH_SKIP_BENCHMARKS}") |
There was a problem hiding this comment.
I still don't see the motivation for this. If a user does not want to build all targets they can simply skip passing --target all. What you instead want might be a custom target. This could be created from a positive list instead. However, I would propose to avoid the regex approach.
CMakeLists.txt
Outdated
| else() | ||
| set(CMAKE_HIP_ARCHITECTURES "${HECBENCH_HIP_ARCH}") | ||
| endif() | ||
| find_package(HIP MODULE QUIET) |
There was a problem hiding this comment.
If HIP is enabled, and the below message states this, you don't want to silently fail on find_package(HIP) do you?
CMakeLists.txt
Outdated
| else() | ||
| message(WARNING "OpenMP requested but not found - OpenMP benchmarks will be skipped") | ||
| set(HECBENCH_ENABLE_OPENMP OFF) | ||
| message(STATUS "OpenMP enabled") |
There was a problem hiding this comment.
Why is this dropped? This seems unrelated to your PR thus I'd suggest to not touch it.
CMakeLists.txt
Outdated
| include(CheckLanguage) | ||
| check_language(HIP) | ||
| if(CMAKE_HIP_COMPILER) | ||
| enable_language(HIP) |
There was a problem hiding this comment.
Why not adding HIP conditionally to LANGUAGES e.g. via project(LANGUAGES C CXX ${HIP_OPTIONAL}?
Summary
amdgcnspirv-style offload), and skip lists (string + optional file).HECBENCH_ENABLE_*options stay ON and skip lists are empty.Motivation
HIP_ARCHITECTURES/--offload-arch=${HECBENCH_HIP_ARCH}.Changes
CMakeLists.txtHECBENCH_ENABLE_HIP_ONLY— HIP-only discovery; warns if other model cache vars still look enabled.HECBENCH_ENABLE_SPIRV,HECBENCH_SPIRV_TARGET— SPIR-V mode; defaultHECBENCH_HIP_EXTRA_CFLAGS/HECBENCH_HIP_LDFLAGSwhen unset.HECBENCH_HIP_EXTRA_CFLAGS,HECBENCH_HIP_LDFLAGS— global HIP compile/link options (HIP language only).CMAKE_HIP_ARCHITECTURES—HECBENCH_SPIRV_TARGETif SPIR-V, elseHECBENCH_HIP_ARCH.HECBENCH_SKIP_BENCHMARKS,HECBENCH_SKIP_BENCHMARKS_FILE— merged skip list with#comments in the file.check_language(HIP)/enable_language(HIP)when HIP is on but the HIP compiler was not set at firstproject().find_package(OpenMP REQUIRED)— drop deadelseafterREQUIRED.src/CMakeLists.txtadd_subdirectoryonly if the benchmark’s model matches an enabledHECBENCH_ENABLE_*.HECBENCH_SKIP_BENCHMARKS_FILE.cmake/modules/BenchmarkMacros.cmakeHIP_ARCHITECTURESand--offload-arch=${HECBENCH_HIP_ARCH}; add-Wno-#warningsfor HIP only.Example
cmake -S . -B build \ -DHECBENCH_ENABLE_HIP_ONLY=ON \ -DHECBENCH_ENABLE_SPIRV=ON \ -DCMAKE_HIP_COMPILER=/path/to/clang++ \ -DHECBENCH_HIP_ARCH=gfx942 cmake --build build