Nvptx's  -march-map=  maps the specified compute capability sm_...
to -march=... - The idea is that one specifies the actually hardware
and GCC then picks the best supported -march=.

[For every -march=, GCC actually produces different code while JIT is
used to produce the ISA for the hardware to be run.]

This patch honors CUDA 13's renaming of Jetson Thor's compute capability
from 101 to 110. And CUDA 13.4 then added 107 for Rubin GPUs.

OK for mainline?

Tobias
nvptx/nvptx.opt: Update -march-map= for newer sm_{107,110}{,a,f}
    
Usage of the -march-map=: "Select the closest available '-march=' value
that is not more capable."
    
PTX ISA 9.0 (CUDA 13.0) added SM_110{,a,f} - which is a renamed SM_101
(Jetson Thor).  PTX ISA 9.4 (CUDA 13.4) added SM_107{,a,f} (Rubin).
['a' = ISA for that specific arch only, 'f' stands for the family, only.]
    
Internally, GCC currently generates the same code for >= sm_80 (Ampere);
however, as GCC's -march= also supports sm_89 (Ada), the here added
sm_1xxs will map to sm_89.
    
[Naming note: while ptx code generated for sm_X can also run with sm_Y
if Y > X, code generated for sm_XXXa can (generally) only run on
the specific hardware; and sm_XXXf implies compatibility with only
subsequent targets in the same family.]

gcc/ChangeLog:
    
	* config/nvptx/nvptx.opt (march-map=): Add sm_107{,f,a} and
	sm_110{,f,a}.

diff --git a/gcc/config/nvptx/nvptx.opt b/gcc/config/nvptx/nvptx.opt
index 343f3ec9e05..34a031baec0 100644
--- a/gcc/config/nvptx/nvptx.opt
+++ b/gcc/config/nvptx/nvptx.opt
@@ -129,6 +129,7 @@ Target RejectNegative Alias(misa=,sm_89)
 march-map=sm_100a
 Target RejectNegative Alias(misa=,sm_89)
 
+; Note: PTX ISA 9.0 renamed sm_101 to sm_110
 march-map=sm_101
 Target RejectNegative Alias(misa=,sm_89)
 
@@ -147,6 +148,24 @@ Target RejectNegative Alias(misa=,sm_89)
 march-map=sm_103a
 Target RejectNegative Alias(misa=,sm_89)
 
+march-map=sm_107
+Target RejectNegative Alias(misa=,sm_89)
+
+march-map=sm_107f
+Target RejectNegative Alias(misa=,sm_89)
+
+march-map=sm_107a
+Target RejectNegative Alias(misa=,sm_89)
+
+march-map=sm_110
+Target RejectNegative Alias(misa=,sm_89)
+
+march-map=sm_110f
+Target RejectNegative Alias(misa=,sm_89)
+
+march-map=sm_110a
+Target RejectNegative Alias(misa=,sm_89)
+
 march-map=sm_120
 Target RejectNegative Alias(misa=,sm_89)
 

Reply via email to