Skip to content

Remove dmap and deprecated distributions#28329

Open
bradcray wants to merge 24 commits intochapel-lang:mainfrom
bradcray:remove-deprecated-dists
Open

Remove dmap and deprecated distributions#28329
bradcray wants to merge 24 commits intochapel-lang:mainfrom
bradcray:remove-deprecated-dists

Conversation

@bradcray
Copy link
Member

@bradcray bradcray commented Jan 21, 2026

This PR removes the deprecated symbols related to distributions, layouts, and the dmap type. Specifically, it removes:

  • the dmap type
  • distributions that had previously been implemented as classes and been deprecated (e.g., Block was deprecated in favor of blockDist)
  • the deprecated LayoutCS module
  • a deprecated config const in BlockDist.chpl, disableAliasedBulkTransfer.

It also updates tests and documentation to remove references to the dmap type even in places where it doesn't terribly matter.

In more detail:

  • I simply removed all deprecated distributions (BlockCyclic, Block, Cyclic, DimensionalDist2D, Hashed, Private, Replicated, Stencil), associated comments, and the aforementioned config

  • Similarly, I removed the LayoutCS module and all references to it

  • The dmap type was still used to create the logical singleton defaultDist, as it still provides the value-based wrapping around the DefaultDist class. Ultimately, DefaultDist should be rewritten to be a record, but here I took the simpler and more minimal approach of renaming the dmap type to chpl_dmap, effectively making it an internal symbol. Beyond updating defaultDist's use of it, this also required updating Dyno to recognize the new name, as it is currently special-cased there.

  • I removed a pair of helper routines in ChapelArray.chpl that existed merely to keep the dmap type working while deprecated.

  • I removed tests in the test/deprecated directory related to these features

  • Interestingly, the removal of disableAliasedBulkTransfer caused BlockDist.chpl to go from being a non-dead module to a dead one; presumably, the presence of a config in a module prevents it from being dead-code eliminated since it represents a (potential) user-facing feature. This required updates to tests that were sensitive to module init/deinit order and counts of dead modules, such as:

    • test/modules/sungeun/init/printModuleInitOrder.chpl
    • test/modules/vass/deinit-order-modules.verbose.chpl
    • test/optimizations/deadCodeElimination/elliot/countDeadModules.chpl
  • In SparseBlockDist.getDefaultSparseDist(), I changed a case that relied on dmap into a halt() because I believe it was only used for (old, now removed) class-based distributions, so should no longer be hit in practice. In essence, the halt() serves as an always-on assertion.

  • I added a pair of records to wrap class-based distributions to DSIUtil.chpl, similar to how chpl_PrivatizedDistHelper did this for the Block, Cyclic, etc. classes when they were being converted into records. One is for wrapping a rectangular distribution, the other for associative (chpl__rectLayoutHelper and chpl__assocLayoutHelper, respectively). At present, these are only used by tests in the test system that created custom distribution classes, though if we had class-based layouts, they could be used there as well to convert to record-based implementations. That said, if writing a new record-based distribution today, it should simply be written as a record, which would obviate the need for wrapping a class. Put another way, this is just a trick to minimize the amount of code that needs to be rewritten; with more effort, the tests that create custom distributions could/should be rewritten to simply use a record type as well.

  • Tests with custom class-based distributions that required updates to use record-based distributions (and leverage the above helpers) included:

    • MyDist => myDist in test/arrays/dmapped-new-error-class.chpl
    • MyDist => myDist in test/distributions/bradc/wrongDomForDist/*.chpl
    • GlobalDistribution => globalDistribution in test/domains/vass/no-dom-field-error.chpl
    • AccumStencil => accumStencil in test/studies/comd/elegant/arrayOfStructs/util/*.chpl
  • I updated tests or code patterns that relied on new dmap(new DefaultDist()) to simply use defaultDist instead, such as in test/unstable/dmapped-sparse.chpl and test/users/engin/sparse_bulk/sparseBulkBoundsCheck.chpl

  • I simplified an error message in normalize.cpp that referred to new dmap() to avoid it and to avoid worrying about class-based distributions, which shouldn't exist anymore while also improving the error message to name the distribution type that was used rather than relying on a placeholder. I similarly removed test/arrays/dmapped-new-error-class.chpl which served only to lock in the version of the error message for class-based distributions.

  • I also removed test/distributions/diten/domainMethodNewDist.chpl which seemed to serve no particular purpose in a dmap-less world

  • I removed index entries in the spec related to the dmap type and updated some examples of dmapped blockDist() to read dmapped new blockDist() as well, which is now required

  • I removed obvious references to the dmap type from doc/rst/technotes/dsi.rst and made some simple edits to the document to reflect the current record-based assumption about distribution type, but it's almost certain that more about this docuement should be refreshed or cleaned up w.r.t. record-based distributions.

  • I also updated a bunch of tests that weren't running or weren't consequential or that mentioned dmap in their comments to avoid the term, primarily for the sake of reducing false positives when looking for ongoing references to dmap

…sed dists

---
Signed-off-by: Brad Chamberlain <bradcray@users.noreply.github.com>
These utility records are designed to convert old layout classes into
records by wrapping them, similar to what 'chpl_PrivatizedDistHelper'
did for distribution classes.  One is designed for rectangular arrays,
the other for associative.

---
Signed-off-by: Brad Chamberlain <bradcray@users.noreply.github.com>
…rpose

---
Signed-off-by: Brad Chamberlain <bradcray@users.noreply.github.com>
---
Signed-off-by: Brad Chamberlain <bradcray@users.noreply.github.com>
This mirrors what we've had for 'DefaultDist'.  Neither of these are
public symbols, but 'defaultDist' seems much more like the kind of
thing we'd expose to users than 'DefaultDist' (in that we're not
exposing class-based distributions anymore and there's no reason for
the default distribution to be other than a singleton).

---
Signed-off-by: Brad Chamberlain <bradcray@users.noreply.github.com>
With this PR, BlockDist no longer contains a config const/var that was
keeping it alive, so it is now considered dead and removed.  This
causes it not to be initialized since it's removed, and to slightly
perturb the order of module init/deinit, requiring updates to
printModuleInitOrder, countDeadModules, and deinit-order-modules.

Interestingly, the comm-*.good files for the countDeadModules test
also differed by one though my edit here changes by 4.  I think this
suggests that these tests are no longer being run in our ofi/ugni
configurations, which seems likely to be given that we've dialed down
system-specific full-suite testing as resources have been retired or
changed.

---
Signed-off-by: Brad Chamberlain <bradcray@users.noreply.github.com>
---
Signed-off-by: Brad Chamberlain <bradcray@users.noreply.github.com>
…ultDist

---
Signed-off-by: Brad Chamberlain <bradcray@users.noreply.github.com>
…direct uses

---
Signed-off-by: Brad Chamberlain <bradcray@users.noreply.github.com>
…instead

In both cases, I used the pattern also used by most of our
distributions now in which the record has a forwarding field to a
record that handles the standard distribution interface forwarding to
an old class-based implementation.  In truth, there's no strong reason
to preserve the class, but this approach requires fewer code changes
and matches what we've done for other distributions.

---
Signed-off-by: Brad Chamberlain <bradcray@users.noreply.github.com>
---
Signed-off-by: Brad Chamberlain <bradcray@users.noreply.github.com>
---
Signed-off-by: Brad Chamberlain <bradcray@users.noreply.github.com>
@bradcray bradcray marked this pull request as ready for review January 24, 2026 02:20
Copy link
Member

@jabraham17 jabraham17 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good!

Just noting that I still see mentions of dmap in the docs

  • doc/rst/technotes/dsi.rst
  • doc/rst/language/spec/domain-maps.rst

And those should probably be updated as well

@@ -1 +1 @@
dmapped-new-error-class.chpl:14: error: dmapped initialization expression requires a value, not a type - did you mean to use '<domain> dmapped new dmap(new <DistName>(<args>))'?
dmapped-new-error-class.chpl:20: error: dmapped initialization expression requires a value, not a type - did you mean to use '<domain> dmapped new dmap(new <DistName>(<args>))'?
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This error message is now incorrect, there is no dmap a user can use

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also a good catch! I'm going to remove this test (in addition to removing the compiler logic that printed new dmap(), as it was specific to a time when some, but not all, distributions were converted to classes.

While here, I also updated the error message to print the actual distribution type rather than <DistName> which seems like an obvious/simple improvement.

…city

Jade pointed out that I'd missed an instance of 'new dmap()' in this
error message, which made me realize that the case checking for
class-based dmaps need not exist any longer, permitting me to simplify
the logic and remove a test that no longer matters.  While poking at
this error, I also realized that it could be improved by simply
printing the name of the distribution being used, which we have
handy in this case.

---
Signed-off-by: Brad Chamberlain <bradcray@users.noreply.github.com>
…apped exprs

Jade caught that there were index terms for the 'dmap' type still in
the spec, so this commit removes them.  While checking the rest of
this file, I realized that some examples of 'dmapped' failed to use
'new' before 'blockDist()' (in code that is not currently being
tested), so updated those cases to avoid the obvious error.

---
Signed-off-by: Brad Chamberlain <bradcray@users.noreply.github.com>
Jade pointed out that there were remaining references to 'dmap' in
this document, so this removes them.  To do that required also
describing the top-level distribution type as a record rather than a
class, which also motivated making some updates to the expected API
for the record.  This leaves this technote strictly better than it
was, but there's still a lot that could be done to improve it and
bring it into better sync with current practice, I believe.

---
Signed-off-by: Brad Chamberlain <bradcray@users.noreply.github.com>
---
Signed-off-by: Brad Chamberlain <bradcray@users.noreply.github.com>
This is relying on using "distribution" as a general term, which
is questionable, but hopefully it's clear enough.

---
Signed-off-by: Brad Chamberlain <bradcray@users.noreply.github.com>
This test has been notested for awhile, but had instances of 'new
dmap()' that I felt I couldn't leave in good conscience, if for no
other reason that to have zero matches when searching for 'new dmap()'
calls.  While here, I did a bit more to bring it more in-sync with
current distribution logic, but not enough to get it compiling before
deciding it wasn't currently worth my time.

---
Signed-off-by: Brad Chamberlain <bradcray@users.noreply.github.com>
---
Signed-off-by: Brad Chamberlain <bradcray@users.noreply.github.com>
… more accurate

---
Signed-off-by: Brad Chamberlain <bradcray@users.noreply.github.com>
---
Signed-off-by: Brad Chamberlain <bradcray@users.noreply.github.com>
---
Signed-off-by: Brad Chamberlain <bradcray@users.noreply.github.com>
---
Signed-off-by: Brad Chamberlain <bradcray@users.noreply.github.com>
@bradcray
Copy link
Member Author

bradcray commented Feb 3, 2026

@jabraham17 : Thanks for catching those cases I missed. I used your comments to look for other references to dmap that I'd missed using:

git grep `new dmap`
git grep dmap | grep -v dmapped | grep -v chpl_dmap | grep -v third-party

This isn't perfect since a line of code with dmap and dmapped on a single line could occur and slip past my checks, but it's much more complete than I'd been before.

This resulted in me getting into a bunch of tests and comments that weren't particularly important, but I like that it left things in a cleaner condition w.r.t. dmap. I don't know if it's worth your time to review the delta between your last review and this one or not. Most of it is somewhere between "trivial" and "not terribly interesting", but I wanted to at least give you the chance to take a look if you were interested (I'm working on refreshing the OP now).

Comment on lines +123 to +127
.. method:: proc GlobalDistribution.newRectangularDom(param rank: int,
type idxType,
param strides: strideKind,
ranges: rank*range(idxType, boundKind.both, strides),
definedConst: bool = false)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't know how well sphinx will render this, I don't think it can handle newlines in a .. method. Did you check it?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants