Open apanqasem opened 7 years ago
@bradcray have we implemented this?
@vasslitvinov : @daviditen added some support for RMO vs. CMO in https://github.com/chapel-lang/chapel/pull/11316 but I don't know how much testing it's received since then, and from a quick read of the PR's OP, it's not clear to me whether or not it was complete at the time it was merged.
Chapel standard release currently does not provide support for Column-major ordering (CMO) of multi-dimensional arrays.
Language-level support for automatic layout conversion is becoming increasingly important in the context of heterogenous computing. For instance, the performance of the
forall
loop in the code below will be impacted (potentially by integer factors) by (i) whether data and computation is mapped to host (CPU) or device (GPU) and (ii) ifdom
follows a row-major or column-major ordering.One approach to implementing this feature (suggested by @bradcray) is to have the
DefaultRectangular
layout take aparam
argument indicating whether to use row- or column-major order. This can then be invoked as followsThe parameter value would dictate if the domains (and access functions) should be reversed (CMO). This approach is probably the least invasive.
Calling
DefaultDist()
to change the layout might be somewhat counter-intuitive. Another approach is to create a new layout module and invoke it as followsThe above would entail a lot code duplication, however.