spcl / dace

DaCe - Data Centric Parallel Programming
http://dace.is/fast
BSD 3-Clause "New" or "Revised" License
487 stars 121 forks source link

Fill library node #1576

Open tbennun opened 3 months ago

tbennun commented 3 months ago

Filling an entire data container (like an array) with a single value is a common use case in DaCe codes. Instead of manually specifying how a container should be filled, we would like to have a Library Node that specifies that an array should be filled with a certain value. This is also a performant feature because it can be specialized. Examples:

The library node should be implemented with one output leading to the data container to be filled, and an optional input connector called value which can specify a runtime value to fill. In case the value is constant or symbolic, the input may exist as a property. This is similar to how alpha/beta values are treated in matrix multiplication library nodes.

The library node will live in the DaCe Standard library, similarly to other basic operations such as Reduce. To help with the implementation, refer to the einsum library node. To see how input/output connectors can be defined, refer to TensorTranspose.

The implementation tasks are as follows:

  1. Implement the Fill library node in the Standard library
  2. Implement a native expansion that uses only SDFG components under the 'pure' expansion
  3. (optional) Implement fast specializations
  4. Create Fill library nodes in the Python frontend instead of the manual implementation (replacing the implementation of numpy.full)
sahaj1997 commented 1 month ago

Hey @tbennun Is this issue still open and could I take this up ? Looking at the file history of https://github.com/spcl/dace/tree/master/dace/libraries it looks like I can.

tbennun commented 1 month ago

@sahaj1997 Yes! This issue is open and you can take it up. I added some resources on the original post that may be useful.