ROCm / rocThrust

ROCm Thrust - run Thrust dependent software on AMD GPUs
https://rocm.docs.amd.com/projects/rocThrust/en/latest/
Apache License 2.0
99 stars 46 forks source link

[Issue]: Build with Clang >= 19 and libc++ fails on _VSTD macro #478

Open AngryLoki opened 3 weeks ago

AngryLoki commented 3 weeks ago

Problem Description

Hi,

#include <thrust/type_traits/is_contiguous_iterator.h> does not work with new versions of Clang when libc++ is enabled in compiler flags (i. e. clang version 19.1.0+libcxx CXXFLAGS=--stdlib=libc++).

The error is caused by lines: https://github.com/ROCm/rocThrust/blob/6f47412b99e64a1d4681d9e0312132e4ad6042ec/thrust/type_traits/is_contiguous_iterator.h#L139-L144

Historical notes for _VSTD macro:

As seen on godbolt, _VSTD indeed was just std in Clang 17/18 - https://godbolt.org/z/nMWhj8PqT.

As ROCm stack effectively does not support anything earlier than Clang 17, is should be safe to replace _VSTD with std. Could you please replace one line?

-   _VSTD::__wrap_iter<Iterator>
+   std::__wrap_iter<Iterator>

That's the only change required in rocThrust to fix compilation with Clang 19.1.0 (tested with pytorch). Thanks!

Operating System

Gentoo

CPU

-

GPU

AMD Instinct MI300X

ROCm Version

ROCm 6.2.2

ROCm Component

rocThrust

Steps to Reproduce

No response

(Optional for Linux users) Output of /opt/rocm/bin/rocminfo --support

No response

Additional Information

No response

Naraenda commented 2 weeks ago

Thanks for the report. The change from _VSTD to std was part of the CCCL 2.4 update. The ROCm 6.4 release should include compatibility/parity with 2.4 and also the requested change.

More specifically, it is fixed in https://github.com/ROCm/rocThrust/pull/462 in change https://github.com/ROCm/rocThrust/pull/462/commits/93b72cd8b9c6e53f1ac8067a83440736521d5c1f.