Files
derek.holloway 7502bf64a4
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
Flatten subprojects into a single base monorepo
2026-09-02 16:34:47 -07:00

79 lines
2.3 KiB
C++

/*
* Copyright (c) Advanced Micro Devices, Inc., or its affiliates.
*
* SPDX-License-Identifier: MIT
*/
#pragma once
#include "top.hpp"
#include "platform/command_utils.hpp"
#include <atomic>
#include <array>
#include <mutex>
#include <shared_mutex>
#include <utility>
namespace amd {
class Command;
} // namespace amd
enum OpId { OP_ID_DISPATCH = 0, OP_ID_COPY = 1, OP_ID_BARRIER = 2, OP_ID_NUMBER = 3 };
#include "prof_protocol.h"
namespace amd::activity_prof {
extern std::atomic<int (*)(activity_domain_t domain, uint32_t operation_id, void* data)>
report_activity;
#if defined(__linux__)
extern __thread activity_correlation_id_t correlation_id __attribute__((tls_model("initial-exec")));
#elif defined(_WIN32)
extern __declspec(thread) activity_correlation_id_t correlation_id;
#endif // defined(_WIN32)
constexpr OpId OperationId(cl_command_type commandType) {
switch (commandType) {
case CL_COMMAND_NDRANGE_KERNEL:
case CL_COMMAND_TASK:
case ROCCLR_COMMAND_STREAM_WAIT_VALUE:
case ROCCLR_COMMAND_STREAM_WRITE_VALUE:
case ROCCLR_COMMAND_BATCH_STREAM:
return OP_ID_DISPATCH;
case CL_COMMAND_READ_BUFFER:
case CL_COMMAND_READ_BUFFER_RECT:
case CL_COMMAND_WRITE_BUFFER:
case CL_COMMAND_WRITE_BUFFER_RECT:
case CL_COMMAND_COPY_BUFFER:
case CL_COMMAND_COPY_BUFFER_RECT:
case CL_COMMAND_FILL_BUFFER:
case CL_COMMAND_READ_IMAGE:
case CL_COMMAND_WRITE_IMAGE:
case CL_COMMAND_COPY_IMAGE:
case CL_COMMAND_FILL_IMAGE:
case CL_COMMAND_COPY_BUFFER_TO_IMAGE:
case CL_COMMAND_COPY_IMAGE_TO_BUFFER:
case ROCCLR_COMMAND_BATCH_COPY_BUFFER:
case ROCCLR_COMMAND_BATCH_WRITE_BUFFER:
case ROCCLR_COMMAND_BATCH_READ_BUFFER:
return OP_ID_COPY;
case CL_COMMAND_MARKER:
return OP_ID_BARRIER;
default:
return OP_ID_NUMBER;
}
}
bool IsEnabled(OpId operation_id);
void ReportActivity(const amd::Command& command);
// Signals roctracer that CLR commits to delivering one activity record for
// this operation. Must be called exactly once per command that will produce
// a record. The counter lives in roctracer; this just forwards the signal
// via the registered callback using a reserved sentinel (data = 0x1).
void CommitRecord(OpId operation_id);
const char* getOclCommandKindString(cl_command_type kind);
} // namespace amd::activity_prof