File indexing completed on 2026-07-26 08:22:12
0001
0002
0003
0004
0005
0006
0007
0008
0009 #include "utils.hpp"
0010
0011 #include "hip_error_handling.hpp"
0012
0013 namespace traccc::hip::details {
0014
0015 int get_device() {
0016 int d = -1;
0017 [[maybe_unused]] auto code = hipGetDevice(&d);
0018 return d;
0019 }
0020
0021 unsigned int get_warp_size(int device) {
0022 int warp_size = 0;
0023 TRACCC_HIP_ERROR_CHECK(
0024 hipDeviceGetAttribute(&warp_size, hipDeviceAttributeWarpSize, device));
0025 return static_cast<unsigned int>(warp_size);
0026 }
0027
0028 hipStream_t get_stream(const stream& stream) {
0029 return reinterpret_cast<hipStream_t>(stream.hipStream());
0030 }
0031
0032 select_device::select_device(int device) {
0033
0034
0035
0036
0037
0038 TRACCC_HIP_ERROR_CHECK(hipGetDevice(&m_device));
0039 TRACCC_HIP_ERROR_CHECK(hipSetDevice(device));
0040 }
0041
0042 select_device::~select_device() {
0043
0044
0045
0046
0047 TRACCC_HIP_ERROR_CHECK(hipSetDevice(m_device));
0048 }
0049
0050 int select_device::device() const {
0051 return m_device;
0052 }
0053
0054 }