-
Notifications
You must be signed in to change notification settings - Fork 256
Coding Style
Chao Liu edited this page Mar 30, 2022
·
19 revisions
- Class:
ClassName - Class member function:
void MemberFunctionName() - Class member variable:
class_member_ - Template argument:
TemplateArgument - Function:
void function_name() - Function arguement:
function_argument_nameorfunctionArgumentName - Local variable:
local_variable_nameorlocalVariableName - Compiler time constant:
kConstant??? - pointer:
p_pointer_nameorpPointerName
- For index, only opaque type
index_tandlong_index_tshould be used, concrete integer type likeint,int32_t,longis not allowed - If tensor data that is integer type, only concrete type like
int32_t,uint32_t,int64_tare allow. Also, useint32_tinstead ofint, useuint32_tinstead ofunsigned
- Use enum class instead of enum
- A tensor descriptor must clearly indicate:
- Each dimension of tensor in the correct order
- The scope of the tensor: grid/block/wave/thread level
- For example, for grid level input image tensor
In[N, C, Hi, Wi]should be declared asconst InGridDescriptor_N_C_Hi_Wi in_grid_desc_n_c_hi_wi
- Avoid explicit type conversion in GPU code, use
ck::type_convertfor casting
- use
#pragma once
- Must add bracket for all
if/else,switch/case -
xsmeans "a container of x object", not "number of x objects"