2 Copyright 1988-2022 Free Software Foundation, Inc.
3 This is part of the GCC manual.
4 For copying conditions, see the copyright.rst file.
6 .. _amd-gcn-function-attributes:
8 AMD GCN Function Attributes
9 ^^^^^^^^^^^^^^^^^^^^^^^^^^^
11 These function attributes are supported by the AMD GCN back end:
13 .. index:: amdgpu_hsa_kernel function attribute, AMD GCN
15 .. amd-gcn-fn-attr:: amdgpu_hsa_kernel
17 This attribute indicates that the corresponding function should be compiled as
18 a kernel function, that is an entry point that can be invoked from the host
19 via the HSA runtime library. By default functions are only callable only from
22 This attribute is implicitly applied to any function named ``main``, using
25 Kernel functions may return an integer value, which will be written to a
26 conventional place within the HSA "kernargs" region.
28 The attribute parameters configure what values are passed into the kernel
29 function by the GPU drivers, via the initial register state. Some values are
30 used by the compiler, and therefore forced on. Enabling other options may
31 break assumptions in the compiler and/or run-time libraries.
33 ``private_segment_buffer``
34 Set ``enable_sgpr_private_segment_buffer`` flag. Always on (required to
38 Set ``enable_sgpr_dispatch_ptr`` flag. Always on (required to locate the
42 Set ``enable_sgpr_queue_ptr`` flag. Always on (required to convert address
45 ``kernarg_segment_ptr``
46 Set ``enable_sgpr_kernarg_segment_ptr`` flag. Always on (required to
47 locate the kernel arguments, "kernargs").
50 Set ``enable_sgpr_dispatch_id`` flag.
53 Set ``enable_sgpr_flat_scratch_init`` flag.
55 ``private_segment_size``
56 Set ``enable_sgpr_private_segment_size`` flag.
58 ``grid_workgroup_count_X``
59 Set ``enable_sgpr_grid_workgroup_count_x`` flag. Always on (required to
62 ``grid_workgroup_count_Y``
63 Set ``enable_sgpr_grid_workgroup_count_y`` flag.
65 ``grid_workgroup_count_Z``
66 Set ``enable_sgpr_grid_workgroup_count_z`` flag.
69 Set ``enable_sgpr_workgroup_id_x`` flag.
72 Set ``enable_sgpr_workgroup_id_y`` flag.
75 Set ``enable_sgpr_workgroup_id_z`` flag.
78 Set ``enable_sgpr_workgroup_info`` flag.
80 ``private_segment_wave_offset``
81 Set ``enable_sgpr_private_segment_wave_byte_offset`` flag. Always on
82 (required to locate the stack).
85 Set ``enable_vgpr_workitem_id`` parameter. Always on (can't be disabled).
88 Set ``enable_vgpr_workitem_id`` parameter. Always on (required to enable
92 Set ``enable_vgpr_workitem_id`` parameter. Always on (required to use