Parcourir la source

clang-format: Apply formatting to HIP sources with .hip extension

Brad King il y a 6 mois
Parent
commit
b8dd3b208a

+ 1 - 0
.gitattributes

@@ -60,6 +60,7 @@ coverage.xml.in  tab-indent
 *.H              our-c-style
 *.h              our-c-style
 *.hh             our-c-style
+*.hip            our-c-style
 *.hpp            our-c-style
 *.hxx            our-c-style
 *.notcu          our-c-style

+ 1 - 2
Tests/HIP/InferHipLang1/interface.hip

@@ -1,15 +1,14 @@
 #include <system_error>
 #include <type_traits>
+
 #include <hip/hip_runtime_api.h>
 
 static __global__ void fake_hip_kernel()
 {
 }
 
-
 int __host__ interface_hip_func(int x)
 {
-
   fake_hip_kernel<<<1, 1>>>();
   bool valid = (hipSuccess == hipGetLastError());
   if (!valid) {

+ 1 - 2
Tests/HIP/InferHipLang2/interface.hip

@@ -1,15 +1,14 @@
 #include <system_error>
 #include <type_traits>
+
 #include <hip/hip_runtime_api.h>
 
 static __global__ void fake_hip_kernel()
 {
 }
 
-
 int __host__ interface_hip_func(int x)
 {
-
   fake_hip_kernel<<<1, 1>>>();
   bool valid = (hipSuccess == hipGetLastError());
   if (!valid) {

+ 12 - 10
Tests/HIP/MathFunctions/main.hip

@@ -1,15 +1,15 @@
-
-#include <stdexcept>
 #include <cmath>
-#include <math.h>
 #include <memory>
+#include <stdexcept>
 
-#include <hip/hip_runtime.h>
 #include <hip/hip_fp16.h>
+#include <hip/hip_runtime.h>
+#include <math.h>
 
 namespace {
-template<class T, class F>
-__global__ void global_entry_point(F f, T *out) {
+template <class T, class F>
+__global__ void global_entry_point(F f, T* out)
+{
   *out = f();
 }
 
@@ -23,7 +23,9 @@ bool verify(F f, T expected)
   }
   bool result = true;
   hipLaunchKernelGGL(global_entry_point, 1, 1, 0, 0, f, gpu_T);
-  result = hipMemcpy(cpu_T.get(), gpu_T, sizeof(T), hipMemcpyDeviceToHost) == hipSuccess && result;
+  result = hipMemcpy(cpu_T.get(), gpu_T, sizeof(T), hipMemcpyDeviceToHost) ==
+      hipSuccess &&
+    result;
   result = hipFree(gpu_T) == hipSuccess && result;
   result = *cpu_T == expected && result;
   return result;
@@ -32,9 +34,9 @@ bool verify(F f, T expected)
 
 int main(int argc, char** argv)
 {
-  bool valid = verify([]__device__(){ return std::round(1.4f); }, 1.0f);
-  valid &= verify([]__device__(){ return max<_Float16>(1.0f, 2.0f); }, 2.0f);
-  valid &= verify([]__device__(){ return min<_Float16>(1.0f, 2.0f); }, 1.0f);
+  bool valid = verify([] __device__() { return std::round(1.4f); }, 1.0f);
+  valid &= verify([] __device__() { return max<_Float16>(1.0f, 2.0f); }, 2.0f);
+  valid &= verify([] __device__() { return min<_Float16>(1.0f, 2.0f); }, 1.0f);
 
   if (valid) {
     return 0;

+ 1 - 3
Tests/HIP/MixedLanguage/shared.hip

@@ -1,5 +1,6 @@
 #include <system_error>
 #include <type_traits>
+
 #include <hip/hip_runtime_api.h>
 
 #ifdef _WIN32
@@ -8,15 +9,12 @@
 #  define EXPORT
 #endif
 
-
 static __global__ void fake_hip_kernel()
 {
 }
 
-
 int __host__ shared_hip_func(int x)
 {
-
   fake_hip_kernel<<<1, 1>>>();
   bool valid = (hipSuccess == hipGetLastError());
   if (!valid) {

+ 2 - 5
Tests/HIP/MixedLanguage/static.hip

@@ -1,17 +1,14 @@
-
-#include <type_traits>
 #include <system_error>
-#include <hip/hip_runtime_api.h>
+#include <type_traits>
 
+#include <hip/hip_runtime_api.h>
 
 static __global__ void fake_hip_kernel()
 {
 }
 
-
 int __host__ static_hip_func(int x)
 {
-
   fake_hip_kernel<<<1, 1>>>();
   bool valid = (hipSuccess == hipGetLastError());
   if (!valid) {

+ 1 - 1
Tests/HIP/TryCompile/device_function.hip

@@ -1,4 +1,5 @@
 #include <system_error>
+
 #include <hip/hip_runtime_api.h>
 
 static __global__ void fake_hip_kernel()
@@ -7,7 +8,6 @@ static __global__ void fake_hip_kernel()
 
 int __host__ try_compile_hip_func(int x)
 {
-
   fake_hip_kernel<<<1, 1>>>();
   bool valid = (hipSuccess == hipGetLastError());
   if (!valid) {