[PATCH] openmp: Add support for target_device selector set in metadirectives

Kwok Cheung Yeung kcy@codesourcery.com
Wed Jan 26 14:21:58 GMT 2022


Hello

Just noticed a bug in the ISA checking in the nvptx plugin - the minor 
version should only be compared if the major version is equal, otherwise 
it would reject an isa of sm_35 if the card is capable of supporting 
sm_52, for example. This patch fixes the issue.

Thanks

Kwok
-------------- next part --------------
diff --git a/libgomp/plugin/plugin-nvptx.c b/libgomp/plugin/plugin-nvptx.c
index 7427677e69d..86a12c3fcfd 100644
--- a/libgomp/plugin/plugin-nvptx.c
+++ b/libgomp/plugin/plugin-nvptx.c
@@ -2047,7 +2047,8 @@ GOMP_OFFLOAD_run (int ord, void *tgt_fn, void *tgt_vars, void **args)
 /* TODO: Implement GOMP_OFFLOAD_async_run. */
 
 #define CHECK_ISA(major, minor) \
-  if (device->compute_major >= major && device->compute_minor >= minor \
+  if (((device->compute_major == major && device->compute_minor >= minor) \
+       || device->compute_major > major) \
       && strcmp (isa, "sm_"#major#minor) == 0) \
     return true
 


More information about the Gcc-patches mailing list