[flang-commits] [flang] bd0aab5 - [Frontend] Sort featuresVec for AMDGPU target features

Fangrui Song via flang-commits flang-commits at lists.llvm.org
Sat Jul 22 15:57:45 PDT 2023


Author: Fangrui Song
Date: 2023-07-22T15:57:41-07:00
New Revision: bd0aab5a159913403c0878a9a2d907caf4b5cfd3

URL: https://github.com/llvm/llvm-project/commit/bd0aab5a159913403c0878a9a2d907caf4b5cfd3
DIFF: https://github.com/llvm/llvm-project/commit/bd0aab5a159913403c0878a9a2d907caf4b5cfd3.diff

LOG: [Frontend] Sort featuresVec for AMDGPU target features

D145579 leverages the iteration order of StringSet, which is not
guaranteed to be deterministic.

Added: 
    

Modified: 
    flang/lib/Frontend/FrontendActions.cpp
    flang/test/Lower/OpenMP/target_cpu_features.f90

Removed: 
    


################################################################################
diff  --git a/flang/lib/Frontend/FrontendActions.cpp b/flang/lib/Frontend/FrontendActions.cpp
index d1158cba4f59cb..0154fd29bf810e 100644
--- a/flang/lib/Frontend/FrontendActions.cpp
+++ b/flang/lib/Frontend/FrontendActions.cpp
@@ -165,7 +165,7 @@ getExplicitAndImplicitAMDGPUTargetFeatures(CompilerInstance &ci,
                            implicitFeatureItem.first().str())
                               .str());
   }
-
+  llvm::sort(featuresVec);
   return llvm::join(featuresVec, ",");
 }
 

diff  --git a/flang/test/Lower/OpenMP/target_cpu_features.f90 b/flang/test/Lower/OpenMP/target_cpu_features.f90
index eb87c814ef63e7..08aee02febb263 100644
--- a/flang/test/Lower/OpenMP/target_cpu_features.f90
+++ b/flang/test/Lower/OpenMP/target_cpu_features.f90
@@ -6,10 +6,10 @@
 !===============================================================================
 
 !CHECK: omp.target = #omp.target<target_cpu = "gfx908",
-!CHECK-SAME: target_features = "+dot3-insts,+dot4-insts,+s-memtime-inst,
-!CHECK-SAME: +16-bit-insts,+s-memrealtime,+dot6-insts,+dl-insts,+image-insts,+wavefrontsize64,
-!CHECK-SAME: +gfx9-insts,+gfx8-insts,+ci-insts,+dot10-insts,+dot7-insts,
-!CHECK-SAME: +dot1-insts,+dot5-insts,+mai-insts,+dpp,+dot2-insts">
+!CHECK-SAME: target_features = "+16-bit-insts,+ci-insts,+dl-insts,+dot1-insts,+dot10-insts,
+!CHECK-SAME: +dot2-insts,+dot3-insts,+dot4-insts,+dot5-insts,+dot6-insts,+dot7-insts,+dpp,
+!CHECK-SAME: +gfx8-insts,+gfx9-insts,+image-insts,+mai-insts,+s-memrealtime,+s-memtime-inst,
+!CHECK-SAME: +wavefrontsize64">
 !CHECK-LABEL: func.func @_QPomp_target_simple()
 subroutine omp_target_simple
   ! Directive needed to prevent subroutine from being filtered out when


        


More information about the flang-commits mailing list