CodeQL / Analyze (actions) (push) Canceled after 0s
CodeQL / Analyze (python) (push) Canceled after 0s
pre-commit / pre-commit (push) Canceled after 0s
Multi-Arch CI / setup (push) Canceled after 0s
Publish build_manylinux_x86_64 images / publish_build_manylinux_x86_64 (push) Canceled after 0s
Setup (Multi-Arch) / setup (push) Canceled after 0s
Multi-Arch CI / Linux::${{ fromJSON(needs.setup.outputs.linux_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubi10 image / publish_no_rocm_image_ubi10 (push) Canceled after 0s
Multi-Arch CI / Windows::${{ fromJSON(needs.setup.outputs.windows_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Multi-Arch CI / Manifest Diff (push) Canceled after 0s
TheRock Manifest Diff Report / Generate Manifest Diff Report (push) Canceled after 0s
Multi-Arch CI / CI Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_ocl_rt images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_rocgdb images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Unit Tests / Unit Tests :: ubuntu-24.04 (push) Canceled after 0s
Unit Tests / Unit Tests :: windows-2022 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_media (push) Canceled after 0s
Unit Tests / Unit Tests Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_openmpi (push) Canceled after 0s
87 lines
3.2 KiB
CMake
87 lines
3.2 KiB
CMake
# Copyright (c) 2026 Advanced Micro Devices, Inc.
|
|
# SPDX-License-Identifier: MIT
|
|
|
|
# Compile-time log group configuration.
|
|
#
|
|
# Groups can be specified by name or raw bitmask:
|
|
# cmake -DRJ_LOG_GROUPS=VM → group 0 only
|
|
# cmake -DRJ_LOG_GROUPS=CP → group 1 only
|
|
# cmake -DRJ_LOG_GROUPS=DBT_HOOKS → group 2 only
|
|
# cmake -DRJ_LOG_GROUPS=PLUGINS → group 3 only
|
|
# cmake -DRJ_LOG_GROUPS=DRIVER → group 4 only
|
|
# cmake -DRJ_LOG_GROUPS=ALL → all groups
|
|
# cmake -DRJ_LOG_GROUPS=0x3 → raw bitmask (groups 0 and 1)
|
|
# cmake -DRJ_LOG_GROUPS=OFF → all logging off (default)
|
|
#
|
|
# The resolved bitmask is passed as -DRJ_LOG_GROUPS=<value> to the
|
|
# compiler. When OFF/0, no -D is emitted and the header defaults to
|
|
# groups=0 via constexpr initialization — disabled groups compile to nothing.
|
|
#
|
|
# Group IDs (must match util/log.h Logger::Group enum):
|
|
# VM (bit 0) Kernel dispatch, instruction execution, memory access.
|
|
# CP (bit 1) Command processor: doorbell, dispatch, completion.
|
|
# DBT_HOOKS (bit 2) ROCR HSA tools DBT hook tracing.
|
|
# PLUGINS (bit 3) Plugin discovery, loading, and configuration.
|
|
# DRIVER (bit 4) KFD driver: ioctl dispatch, process/session state.
|
|
#
|
|
# Usage: include(rj_log) after project().
|
|
|
|
set(RJ_LOG_GROUPS
|
|
"OFF"
|
|
CACHE STRING
|
|
"Log groups: OFF, ALL, or comma-separated names (VM, CP, DBT_HOOKS, PLUGINS, DRIVER). Raw bitmask also accepted."
|
|
)
|
|
|
|
# --- Group name → bit mapping (keep in sync with Logger::Group in log.h) ---
|
|
set(_RJ_GROUP_VM 1) # bit 0
|
|
set(_RJ_GROUP_CP 2) # bit 1
|
|
set(_RJ_GROUP_DBT_HOOKS 4) # bit 2
|
|
set(_RJ_GROUP_PLUGINS 8) # bit 3
|
|
set(_RJ_GROUP_DRIVER 16) # bit 4
|
|
|
|
# All known group bits OR'd together.
|
|
math(
|
|
EXPR
|
|
_RJ_GROUP_ALL
|
|
"${_RJ_GROUP_VM} | ${_RJ_GROUP_CP} | ${_RJ_GROUP_DBT_HOOKS} | ${_RJ_GROUP_PLUGINS} | ${_RJ_GROUP_DRIVER}"
|
|
)
|
|
|
|
# --- Resolve the user value to a numeric bitmask ---
|
|
set(_rj_groups_resolved 0)
|
|
|
|
if(RJ_LOG_GROUPS STREQUAL "OFF" OR RJ_LOG_GROUPS STREQUAL "0")
|
|
# Nothing to do — _rj_groups_resolved stays 0.
|
|
elseif(RJ_LOG_GROUPS STREQUAL "ALL")
|
|
set(_rj_groups_resolved ${_RJ_GROUP_ALL})
|
|
elseif(RJ_LOG_GROUPS MATCHES "^0x[0-9a-fA-F]+$|^[0-9]+$")
|
|
# Raw numeric bitmask — pass through.
|
|
set(_rj_groups_resolved ${RJ_LOG_GROUPS})
|
|
else()
|
|
# Comma-separated group names: "VM", "VM,KFD", etc.
|
|
string(REPLACE "," ";" _group_list "${RJ_LOG_GROUPS}")
|
|
foreach(_group IN LISTS _group_list)
|
|
string(STRIP "${_group}" _group)
|
|
string(TOUPPER "${_group}" _group)
|
|
if(DEFINED _RJ_GROUP_${_group})
|
|
math(
|
|
EXPR
|
|
_rj_groups_resolved
|
|
"${_rj_groups_resolved} | ${_RJ_GROUP_${_group}}"
|
|
)
|
|
else()
|
|
message(
|
|
FATAL_ERROR
|
|
"Unknown log group '${_group}'. Known groups: VM, CP, DBT_HOOKS, PLUGINS, DRIVER. Use OFF or ALL for all."
|
|
)
|
|
endif()
|
|
endforeach()
|
|
endif()
|
|
|
|
if(NOT _rj_groups_resolved EQUAL 0)
|
|
add_compile_definitions(RJ_LOG_GROUPS=${_rj_groups_resolved})
|
|
message(
|
|
STATUS
|
|
"rocjitsu: log groups enabled: ${RJ_LOG_GROUPS} (bitmask=${_rj_groups_resolved})"
|
|
)
|
|
endif()
|