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
91 lines
2.7 KiB
C++
91 lines
2.7 KiB
C++
//===- AMDGPUWaitcntUtils.cpp ---------------------------------------------===//
|
|
//
|
|
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
|
// See https://llvm.org/LICENSE.txt for license information.
|
|
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
|
//
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
#include "AMDGPUWaitcntUtils.h"
|
|
#include "Utils/AMDGPUBaseInfo.h"
|
|
|
|
namespace llvm::AMDGPU {
|
|
|
|
iota_range<InstCounterType> inst_counter_types(InstCounterType MaxCounter) {
|
|
return enum_seq(LOAD_CNT, MaxCounter);
|
|
}
|
|
|
|
StringLiteral getInstCounterName(InstCounterType T) {
|
|
switch (T) {
|
|
case LOAD_CNT:
|
|
return "LOAD_CNT";
|
|
case DS_CNT:
|
|
return "DS_CNT";
|
|
case EXP_CNT:
|
|
return "EXP_CNT";
|
|
case STORE_CNT:
|
|
return "STORE_CNT";
|
|
case SAMPLE_CNT:
|
|
return "SAMPLE_CNT";
|
|
case BVH_CNT:
|
|
return "BVH_CNT";
|
|
case KM_CNT:
|
|
return "KM_CNT";
|
|
case X_CNT:
|
|
return "X_CNT";
|
|
case ASYNC_CNT:
|
|
return "ASYNC_CNT";
|
|
case VA_VDST:
|
|
return "VA_VDST";
|
|
case VM_VSRC:
|
|
return "VM_VSRC";
|
|
case NUM_INST_CNTS:
|
|
return "NUM_INST_CNTS";
|
|
}
|
|
llvm_unreachable("Unhandled InstCounterType");
|
|
}
|
|
|
|
#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
|
|
void Waitcnt::dump() const { dbgs() << *this << '\n'; }
|
|
#endif
|
|
|
|
Waitcnt decodeWaitcnt(const IsaVersion &Version, unsigned Encoded) {
|
|
Waitcnt Decoded;
|
|
Decoded.set(LOAD_CNT, decodeVmcnt(Version, Encoded));
|
|
Decoded.set(EXP_CNT, decodeExpcnt(Version, Encoded));
|
|
Decoded.set(DS_CNT, decodeLgkmcnt(Version, Encoded));
|
|
return Decoded;
|
|
}
|
|
|
|
unsigned encodeWaitcnt(const IsaVersion &Version, const Waitcnt &Decoded) {
|
|
return encodeWaitcnt(Version, Decoded.get(LOAD_CNT), Decoded.get(EXP_CNT),
|
|
Decoded.get(DS_CNT));
|
|
}
|
|
|
|
Waitcnt decodeLoadcntDscnt(const IsaVersion &Version, unsigned LoadcntDscnt) {
|
|
Waitcnt Decoded;
|
|
Decoded.set(LOAD_CNT, decodeLoadcnt(Version, LoadcntDscnt));
|
|
Decoded.set(DS_CNT, decodeDscnt(Version, LoadcntDscnt));
|
|
return Decoded;
|
|
}
|
|
|
|
Waitcnt decodeStorecntDscnt(const IsaVersion &Version, unsigned StorecntDscnt) {
|
|
Waitcnt Decoded;
|
|
Decoded.set(STORE_CNT, decodeStorecnt(Version, StorecntDscnt));
|
|
Decoded.set(DS_CNT, decodeDscnt(Version, StorecntDscnt));
|
|
return Decoded;
|
|
}
|
|
|
|
unsigned encodeLoadcntDscnt(const IsaVersion &Version, const Waitcnt &Decoded) {
|
|
return encodeLoadcntDscnt(Version, Decoded.get(LOAD_CNT),
|
|
Decoded.get(DS_CNT));
|
|
}
|
|
|
|
unsigned encodeStorecntDscnt(const IsaVersion &Version,
|
|
const Waitcnt &Decoded) {
|
|
return encodeStorecntDscnt(Version, Decoded.get(STORE_CNT),
|
|
Decoded.get(DS_CNT));
|
|
}
|
|
|
|
} // namespace llvm::AMDGPU
|