Shader Instruction Survey

This page contains the 3 requested outputs:

  1. CSV ranking of common shader instruction families
  2. Split ranking by shader stage (vertex / fragment / compute)
  3. Mesa/NIR-flavored mapping table

The list is normalized across GLSL, HLSL, and SPIR-V style naming (for example, texture() and Sample() are grouped under texture sampling).

1) CSV Ranking (Occurrence-Oriented)

rank,op_family,typical_share_pct,confidence,notes
1,load,10.0,high,variable uniform buffer reads
2,store,8.0,high,locals outputs memory writes
3,float_add,7.0,high,basic arithmetic path
4,float_mul,6.5,high,scale transforms lighting
5,swizzle_shuffle,5.0,high,component rearrangement
6,composite_construct,4.0,high,vec/mat assembly
7,access_chain_addressing,3.8,high,array struct UBO indexing
8,texture_sample,3.5,high,sampler/image fetch ops
9,float_div,2.8,medium_high,normalization ratios
10,function_call,2.6,medium_high,utility code and abstraction
11,int_add,2.3,medium,index and loop counters
12,float_compare,1.9,medium_high,threshold and branch tests
13,branch_control_flow,1.8,medium_high,if loop switch control
14,composite_extract_insert,1.6,medium,channel and member access
15,type_conversion,1.4,medium,float int uint casts
16,matrix_times_vector,1.2,medium_high,vertex and transform heavy code
17,dot_product,1.1,medium_high,lighting and projection math
18,int_mul,1.0,medium,index math and packing
19,ext_math_dispatch,0.9,high,sqrt sin cos pow exp log
20,normalize,0.8,medium_high,direction vector processing
21,int_compare,0.7,medium,bounds and loop tests
22,sampled_image_setup,0.7,medium,image sampler combine setup
23,phi_ssa_merge,0.6,medium,IR merge points at joins
24,derivatives_dpdx_dpdy,0.5,medium,mostly fragment shader footprints
25,cross_product,0.4,medium_low,normal/tangent specialized paths

2) Split Ranking by Shader Stage

Vertex Shader (Typical)

Rank Op family Why it appears often
1 load Attributes, uniforms, matrices
2 float_mul Matrix and scale math
3 float_add Affine sums and accumulation
4 matrix_times_vector Core position transform path
5 swizzle_shuffle Position/normal component work
6 composite_construct Building vec4 / outputs
7 dot_product Projection and lighting terms
8 normalize Normal/tangent basis handling
9 float_compare Clip/branch conditions
10 branch_control_flow Skinning paths, feature toggles
11 type_conversion Packed attribute conversion
12 int_add Indexing loops/bones
13 int_mul Index arithmetic
14 store Varying/output writes
15 function_call Material/helper routines

Fragment Shader (Typical)

Rank Op family Why it appears often
1 texture_sample Material lookups dominate
2 load Varyings, uniforms, constants
3 float_mul BRDF weights, blending
4 float_add Color/light accumulation
5 swizzle_shuffle Channel-heavy color ops
6 composite_construct Final color and intermediates
7 float_compare Alpha tests, masks, thresholds
8 branch_control_flow Material branches, discard paths
9 derivatives_dpdx_dpdy MIP, normal/detail ops
10 dot_product Lighting and Fresnel terms
11 normalize Lighting vectors
12 ext_math_dispatch pow/sqrt/trig style ops
13 float_div Tone mapping / renormalization
14 store Output target writes
15 function_call Shared shading utilities

Compute Shader (Typical)

Rank Op family Why it appears often
1 load SSBO/UAV/input reads
2 store SSBO/UAV/output writes
3 int_add Thread/index math
4 int_mul Linearization and addressing
5 access_chain_addressing Structured buffer traversal
6 float_add Numeric kernels
7 float_mul Numeric kernels
8 branch_control_flow Bounds checks and tiling
9 int_compare Bounds and predicates
10 type_conversion Mixed int/float pipelines
11 function_call Kernel helper decomposition
12 texture_sample Image-based compute workloads
13 ext_math_dispatch Reduction/filter transforms
14 phi_ssa_merge IR merges in loops/branches
15 sampled_image_setup Texture/image setup in sampled kernels

3) Mesa / NIR Flavored Mapping

Abstract op family GLSL/HLSL examples SPIR-V family Mesa/NIR flavor
load u.x, buf[i] OpLoad nir_intrinsic_load_* (load_uniform, load_ubo, load_ssbo, load_input)
store outColor = c OpStore nir_intrinsic_store_* (store_output, store_ssbo)
float_add a + b OpFAdd nir_op_fadd
float_mul a * b OpFMul nir_op_fmul
float_div a / b OpFDiv nir_op_fdiv
int_add i + 1 OpIAdd nir_op_iadd
int_mul i * stride OpIMul nir_op_imul
swizzle/shuffle v.xyz, v.xzyw OpVectorShuffle Channel swizzles on SSA defs plus vector ALU ops
composite construct vec4(a,b,c,d) OpCompositeConstruct nir_op_vec2/vec3/vec4
composite extract v.x, s.member OpCompositeExtract Lowered to channels/deref extracts
access chain ubo.arr[i].x OpAccessChain nir_deref_* + address calc + load/store intrinsic
texture sample texture(s, uv) / Sample OpImageSample* nir_tex_instr (nir_texop_tex, nir_texop_txl, etc.)
sampled image setup sampler2D combine OpSampledImage Texture/sampler source wiring in nir_tex_instr
dot product dot(a,b) OpDot nir_op_fdot* family (often lowered)
normalize normalize(v) ExtInst normalize nir_op_frsq + mul sequence or helper lowering
matrix*vector M * v OpMatrixTimesVector Lowered to mul/add dot chains in NIR ALU
float compare a < b OpFOrdLessThan etc. nir_op_flt, nir_op_fge, etc.
int compare i < n OpSLessThan etc. nir_op_ilt, nir_op_ige, etc.
branch/control if/for/while OpBranch, OpLoopMerge NIR CF nodes (nir_if, nir_loop)
function call foo(x) OpFunctionCall Calls often lowered/inlined; represented in NIR function impl
ext math dispatch sqrt, sin, pow OpExtInst NIR ALU math ops or lowered approximation sequences
phi / SSA merge SSA join OpPhi nir_phi_instr
derivatives dFdx, dFdy OpDPdx, OpDPdy nir_op_fddx, nir_op_fddy
cross product cross(a,b) ExtInst cross Lowered to mul/sub chains in NIR ALU

Notes