include/ck/utility/get_id.hpp Source File

include/ck/utility/get_id.hpp Source File#

Composable Kernel: include/ck/utility/get_id.hpp Source File
get_id.hpp
Go to the documentation of this file.
1 // SPDX-License-Identifier: MIT
2 // Copyright (c) 2018-2023, Advanced Micro Devices, Inc. All rights reserved.
3 
4 #pragma once
5 
6 #include "ck/ck.hpp"
7 
8 namespace ck {
9 
10 __host__ __device__ constexpr index_t get_warp_size()
11 {
12  // warpSize is defined by HIP
13  return warpSize;
14 }
15 
16 __device__ index_t get_thread_local_1d_id() { return threadIdx.x; }
17 
18 __device__ index_t get_thread_global_1d_id() { return blockIdx.x * blockDim.x + threadIdx.x; }
19 
20 __device__ index_t get_warp_local_1d_id() { return threadIdx.x / get_warp_size(); }
21 
22 __device__ index_t get_block_1d_id() { return blockIdx.x; }
23 
24 __device__ index_t get_grid_size() { return gridDim.x; }
25 
26 __device__ index_t get_block_size() { return blockDim.x; }
27 
28 } // namespace ck
Definition: ck.hpp:264
__device__ index_t get_warp_local_1d_id()
Definition: get_id.hpp:20
__device__ index_t get_grid_size()
Definition: get_id.hpp:24
__host__ constexpr __device__ index_t get_warp_size()
Definition: get_id.hpp:10
__device__ index_t get_block_size()
Definition: get_id.hpp:26
__device__ index_t get_block_1d_id()
Definition: get_id.hpp:22
__device__ index_t get_thread_global_1d_id()
Definition: get_id.hpp:18
int32_t index_t
Definition: ck.hpp:289
__device__ index_t get_thread_local_1d_id()
Definition: get_id.hpp:16