| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Name | Name | Last commit date | ||
|---|---|---|---|---|
parent directory.. | ||||
This example demonstrates a put element operation, which scatters or places elements from a source tensor into specific positions of a destination tensor based on index arrays. This is a fundamental operation for implementing sparse updates, scatter operations, and advanced indexing patterns in deep learning and scientific computing.
The put element operation updates specific positions in a destination tensor using values from a source tensor and position information from index tensors.
Given:
The operation performs: $D[I0[i], I1[i], ..., In[i]] \leftarrow \text{Update}(D[I0[i], I1[i], ..., In[i]], S[i])$
For each element i from 0 to M-1.
Update modes:
The implementation must handle parallel updates and potential conflicts when multiple source elements target the same destination position.
Grid Scheduling: The operation is parallelized over the source elements. Each thread is assigned to process one or more elements from the source tensor.
Index Calculation: For each source element, threads:
Conflict Resolution: When multiple threads attempt to update the same destination position:
Memory Access Optimization:
Ensure the Composable Kernel library is built and installed.
cd /path/to/composable_kernel/build
make -j installcd /path/to/composable_kernel/example/50_put_element
mkdir build && cd build
cmake \
-DCMAKE_CXX_COMPILER=/opt/rocm/bin/hipcc \
-DCMAKE_PREFIX_PATH="/opt/rocm;${CK_INSTALL_PATH}" \
..
make -j# Run the example with default settings
./put_element_xdl
# Run with verification, data initialization, and timing
./put_element_xdl 1 2 1Put element operations are fundamental to many advanced algorithms and data structures.
The performance of put element operations depends heavily on the access patterns:
| Back | FazBrowse Home | New Git URL |