[hsa-branch 1/9] Builtins for gridsize and currentworkgroupsize

Martin Jambor mjambor@suse.cz
Mon Oct 10 16:09:00 GMT 2016


Hi,

the patch below makes the griddim and currentworkgroupsize special HSA
instructions available for omp lowering through a builtin.  They are
then used by subsequent patch to implement conditions determining the
last iteration for the lastprivate OpenMP sharing clause.

Committed to the branch, queued for merge to trunk soon.
Thanks,

Martin

2016-10-03  Martin Jambor  <mjambor@suse.cz>

	* hsa-builtins.def (BUILT_IN_HSA_GRIDSIZE): New.
	(BUILT_IN_HSA_CURRENTWORKGROUPSIZE): Likewise.
	* hsa-gen.c (gen_hsa_insns_for_call): Handle BUILT_IN_HSA_GRIDSIZE.
---
 gcc/hsa-builtins.def | 4 ++++
 gcc/hsa-gen.c        | 6 ++++++
 2 files changed, 10 insertions(+)

diff --git a/gcc/hsa-builtins.def b/gcc/hsa-builtins.def
index dcd0c55..cc0409e 100644
--- a/gcc/hsa-builtins.def
+++ b/gcc/hsa-builtins.def
@@ -33,3 +33,7 @@ DEF_HSA_BUILTIN (BUILT_IN_HSA_WORKITEMID, "hsa_workitemid",
 	  	 BT_FN_UINT_UINT, ATTR_CONST_NOTHROW_LEAF_LIST)
 DEF_HSA_BUILTIN (BUILT_IN_HSA_WORKITEMABSID, "hsa_workitemabsid",
 	  	 BT_FN_UINT_UINT, ATTR_CONST_NOTHROW_LEAF_LIST)
+DEF_HSA_BUILTIN (BUILT_IN_HSA_GRIDSIZE, "hsa_gridsize",
+		 BT_FN_UINT_UINT, ATTR_CONST_NOTHROW_LEAF_LIST)
+DEF_HSA_BUILTIN (BUILT_IN_HSA_CURRENTWORKGROUPSIZE, "hsa_currentworkgroupsize",
+		 BT_FN_UINT_UINT, ATTR_CONST_NOTHROW_LEAF_LIST)
diff --git a/gcc/hsa-gen.c b/gcc/hsa-gen.c
index f63608c..deb2a07 100644
--- a/gcc/hsa-gen.c
+++ b/gcc/hsa-gen.c
@@ -5812,6 +5812,12 @@ gen_hsa_insns_for_call (gimple *stmt, hsa_bb *hbb)
     case BUILT_IN_HSA_WORKITEMABSID:
       query_hsa_grid_dim (stmt, BRIG_OPCODE_WORKITEMABSID, hbb);
       break;
+    case BUILT_IN_HSA_GRIDSIZE:
+      query_hsa_grid_dim (stmt, BRIG_OPCODE_GRIDSIZE, hbb);
+      break;
+    case BUILT_IN_HSA_CURRENTWORKGROUPSIZE:
+      query_hsa_grid_dim (stmt, BRIG_OPCODE_CURRENTWORKGROUPSIZE, hbb);
+      break;
 
     case BUILT_IN_GOMP_BARRIER:
       hbb->append_insn (new hsa_insn_br (0, BRIG_OPCODE_BARRIER, BRIG_TYPE_NONE,
-- 
2.10.0



More information about the Gcc-patches mailing list