OK, it was a great suggestion from Mike Murphy just to replace
.local-s with .global-s and move them to the global scope. The
attached patch changes storage class of the automatic sym to DGLOBAL
or UGLOBAL, and then the whole symtab is written before function
definition. Although, it suites our needs, more generalized solution
should additionally keep non-global entries of symtab inside
functions.
Thanks for the help!
- D.
2011/12/10 Dmitry N. Mikushin <maemar...@gmail.com>:
> Dear Open64 developers,
>
> In our application we need to generate PTX code handling automatic
> variables, that could be too large or must be passed to another
> kernel. Both requirements are incompatible with -CG:auto_as_static=1
> mode, when all variables not mapped onto registers are allocated in
> .local memory. So I'm looking into how to implement
> -CG:auto_as_static=0, allocating data in global memory, using malloc.
> I'd appreciate any advices or suggestions on this topic or code
> references to look at and study from.
>
> Thanks,
> - Dima.
--- a/nvopencc/open64/src/be/cg/NVISA/exp_loadstore.cxx
+++ b/nvopencc/open64/src/be/cg/NVISA/exp_loadstore.cxx
@@ -1064,7 +1064,19 @@ Exp_Ldst (
base_tn = Gen_Symbol_TN (sym, 0, 0);
ofst_tn = Gen_Literal_TN (ofst, 4);
} else {
- FmtAssert(FALSE, ("stack variables not supported"));
+ Set_V_global_mem(variant);
+ if (ST_class(sym) == CLASS_CONST)
+ {
+ Set_ST_class(sym, CLASS_VAR);
+ Set_ST_sclass(sym, SCLASS_DGLOBAL);
+ }
+ else
+ Set_ST_sclass(sym, SCLASS_UGLOBAL);
+ Set_ST_in_global_mem(sym);
+ Set_ST_base(sym, sym);
+ Set_ST_ofst(sym, 0);
+ base_tn = Gen_Symbol_TN (sym, 0, 0);
+ ofst_tn = Gen_Literal_TN (ofst, 4);
}
}
--- a/nvopencc/open64/src/be/cg/cgemit.cxx
+++ b/nvopencc/open64/src/be/cg/cgemit.cxx
@@ -8600,11 +8600,14 @@ EMT_Emit_PU ( ST *pu, DST_IDX pu_dst, WN *rwn )
#endif
#ifdef TARG_NVISA
+ if (!CGEXP_auto_as_static)
+ Process_Bss_Data (CURRENT_SYMTAB);
CGEMIT_Function_Definition(pu);
// emit variable decls before the code
/* Emit the initialized data associated with this PU. */
Process_Initos_And_Literals (CURRENT_SYMTAB);
- Process_Bss_Data (CURRENT_SYMTAB);
+ if (CGEXP_auto_as_static)
+ Process_Bss_Data (CURRENT_SYMTAB);
#else
fprintf ( Asm_File, "\n\t%s Program Unit: %s\n", ASM_CMNT, ST_name(pu) );
#ifdef TARG_SL
------------------------------------------------------------------------------
Learn Windows Azure Live! Tuesday, Dec 13, 2011
Microsoft is holding a special Learn Windows Azure training event for
developers. It will provide a great way to learn Windows Azure and what it
provides. You can attend the event by watching it streamed LIVE online.
Learn more at http://p.sf.net/sfu/ms-windowsazure
_______________________________________________
Open64-devel mailing list
Open64-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/open64-devel