<html>
    <head>
      <base href="https://bugs.llvm.org/">
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - amdgpu_flat_work_group_size is not a hint"
   href="https://bugs.llvm.org/show_bug.cgi?id=42989">42989</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>amdgpu_flat_work_group_size is not a hint
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>clang
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>unspecified
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>All
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>All
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>normal
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>Documentation
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedclangbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>ekuznetsov@live.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org, richard-llvm@metafoo.co.uk
          </td>
        </tr></table>
      <p>
        <div>
        <pre>The documentation
<a href="https://clang.llvm.org/docs/AttributeReference.html#amdgpu-flat-work-group-size">https://clang.llvm.org/docs/AttributeReference.html#amdgpu-flat-work-group-size</a>
specifies that

"Clang supports the __attribute__((amdgpu_flat_work_group_size(<min>, <max>)))
attribute for the AMDGPU target. This attribute may be attached to a kernel
function definition and is an optimization hint."

An attribute is an optimization hint if its presence or absence does not change
the correctness of the program. Is this case, that's not true. When the
attribute is absent, the compiler assumes the default maximum workgroup size of
256. This was, I believe, correct several years ago. But nowadays the workgroup
size can legally go to 1024. In some situations, running a kernel without the
attribute at 1024 results in baffling and hard-to-track bugs (the compiler uses
group memory to offload some local variables, but does not allocate enough of
it for it to actually work).

Either the default maximum must be raised to 1024, or the documentation must be
amended to say that the attribute is mandatory in some situations.

See also <a href="https://github.com/ROCm-Developer-Tools/HIP/issues/1310">https://github.com/ROCm-Developer-Tools/HIP/issues/1310</a> .</pre>
        </div>
      </p>


      <hr>
      <span>You are receiving this mail because:</span>

      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>