Skip to content

Instantly share code, notes, and snippets.

View vasslitvinov's full-sized avatar

Vass Litvinov vasslitvinov

  • Hewlett Packard Enterprise
  • Seattle, WA
View GitHub Profile
@vasslitvinov
vasslitvinov / CSRtoRectangular.patch
Created July 6, 2017 00:18
Making CSR act as a rectangular domain map
diff --git a/modules/layouts/LayoutCSR.chpl b/modules/layouts/LayoutCSR.chpl
index a388bfc..8d46293 100644
--- a/modules/layouts/LayoutCSR.chpl
+++ b/modules/layouts/LayoutCSR.chpl
@@ -52,6 +52,10 @@ class CSR: BaseDist {
return new CSRDom(rank=rank, idxType=idxType, dist=this, parentDom=dom);
}
+ proc dsiNewRectangularDom(param rank: int, type idxType, param stridable: bool, inds) {
+ return new CSRDom(rank=rank, idxType=idxType, dist=this, parentDom={(...inds)});
@vasslitvinov
vasslitvinov / ChapelArray.c
Created April 26, 2019 22:52
generated code for _do_destroy()
/* ChapelArray.chpl:1120 */
/* 968993 */ static void _do_destroy(_domain_DefaultRectangularDom_1_int64_t_F * this11 /* 968997 */ ,
int64_t _ln /* 1440483 */ ,
int32_t _fn /* 1440485 */ ) {
/* 969251 */ DefaultRectangularDom_1_int64_t_F coerce_tmp = NULL;
/* 969062 */ _tuple_2_BaseDom_BaseDist call_tmp67;
/* 1193980 */ _tuple_2_BaseDom_BaseDist ret_tmp;
/* 1420423 */ BaseDom tmp_x1 = NULL;
/* 1420425 */ BaseDist tmp_x2 = NULL;
/* 969104 */ BaseDist distToFree = NULL;
@vasslitvinov
vasslitvinov / gist:896ef63cbe6d6b242ab54fbbbf8b8a96
Created June 18, 2019 05:25
raw output of simple overload-sets checking
158 tests, 1552 calls
-----------------------------------------------------------------------------
[test: arrays/diten/enumArrayMethods.chpl]
quickSort()
QuickSort - Sort.chpl:960 Sort.chpl:1075
c QuickSort - Sort.chpl:960 Sort.chpl:972
@vasslitvinov
vasslitvinov / POI-examples.md
Last active June 4, 2020 20:01
Examples relying on Point of Instantiation (POI) for #6252

Update 2020-06-04: replaced with a comment on #6252

Towards resolving the semantic issue in #6252, here we survey the various realistic examples of code scenarios that rely on POI.

Converting these examples to Constrained Generics (CG) is discussed in this gist.

See also:

  • #8077 presents function hijacking, which arises due to the POI rule.
@vasslitvinov
vasslitvinov / POI-to-CG-conversions.md
Last active June 4, 2020 20:06
Converting POI examples to CG

Update 2020-06-04: replaced with this comment on #6252.

This gist investigates the examples presented here. In particular, how can they be converted to Constrained Generics (CG)? What can we learn from them about POI?

test/functions/generic/poi/canresolve-in-sort.chpl

canResolve and similar Reflection functions are more likely to be affected by #6252. However, that is an artifact of how they are implemented. A different implementation - ex. similar to compilerError() - can remove reliance of canResolve on POI. Which would have no user-observable impact, except for restored correctness in corner cases.

test/functions/generic/poi/forwarding-wrapper.chpl

diff --git a/src/MultiTypeSymEntry.chpl b/src/MultiTypeSymEntry.chpl
--- a/src/MultiTypeSymEntry.chpl
+++ b/src/MultiTypeSymEntry.chpl
@@ -174,57 +174,66 @@
class SymEntry : GenSymEntry
{
/*
generic element type array
etype is different from dtype (chapel vs numpy)
*/