README

Scatter Operator

The developer-doc is written based on the operator code and is intended for users.

Operator Overview

The aclsparseScatter operator scatters the non-zero values of the sparse vector X to the corresponding positions of the dense vector Y and updates Y in place. For each non-zero element in X, the operator performs:

Y[X.indices[i]] = X.values[i],  i ∈ [0, X.nnz)

This API is a Generic API (descriptor mode), aligned with cuSPARSE cusparseScatter. The semantics are pure data movement, involve no floating-point computation, and the output is bit-wise identical to the input X.values (bitwise exact).

Key semantics:

  • idxBase handling: when X.idxBase = ACL_SPARSE_INDEX_BASE_ONE, indices is 1-based, and 1 is subtracted when accessing Y internally; when X.idxBase = ACL_SPARSE_INDEX_BASE_ZERO, indices is used directly.
  • Index order: indices can be unsorted, and the operator does not rely on sorting assumptions.
  • Duplicate indexes: when the indices[i] of multiple i point to the same position, the final written value is the last completed write (last-write-wins). Due to multi-threaded concurrent execution, the behavior is non-deterministic, consistent with cuSPARSE.
  • Out-of-range indexes: the operator does not validate index values at runtime (the host side cannot read device memory). The caller must ensure indices[i] - idxBase ∈ [0, Y.nums), and out-of-range access behavior is undefined, consistent with cuSPARSE.
  • Unwritten positions: positions in Y not covered by scatter keep their original values unchanged.
  • nnz = 0: the API returns success directly, does not launch a kernel, and Y keeps its original values.

This operator includes the following APIs:

API Brief Description
aclsparseScatter Scatters the non-zero values of the sparse vector X to the corresponding positions of the dense vector Y and updates Y in place

Operator Execution APIs

aclsparseScatter

Product support

  • Ascend 950PR&950DT products: Supported
  • Atlas A3 products: Supported
  • Atlas A2 products: Supported

Function prototype

aclsparseStatus_t aclsparseScatter(aclsparseHandle_t handle, aclsparseConstSpVecDescr_t vecX, aclsparseDnVecDescr_t vecY)

Parameter description

Parameter Input/Output Type Description
handle Input aclsparseHandle_t Context handle of the ops-sparse library, carrying stream and other information; cannot be nullptr. Call aclsparseSetStream first to bind the stream, host memory
vecX Input aclsparseConstSpVecDescr_t Sparse vector descriptor (const, read-only), containing size, nnz, indices[nnz], values[nnz], idxType, idxBase, and valueType. size <= vecY.nums and nnz <= size. Host(descr) / Device(data) memory
vecY Input/Output aclsparseDnVecDescr_t Dense vector descriptor whose values[nums] is written in place by the scatter of X. valueType must be consistent with vecX.valueType. Host(descr) / Device(data) memory

The indices and values of vecX are device memory pointers, passed in when the descriptor is created (aclsparseCreateConstSpVec / aclsparseCreateSpVec). The values of vecY are likewise passed in by aclsparseCreateDnVec.

Parameter Description for Atlas A2 Products and Atlas A3 Products

Parameter Input/Output Type Description
handle Input aclsparseHandle_t Context handle of the ops-sparse library, carrying the execution stream, host memory
vecX Input aclsparseConstSpVecDescr_t Input sparse vector descriptor (read-only, created by aclsparseCreateConstSpVec / aclsparseCreateSpVec), whose indices/values are device pointers, host memory
vecY Input/Output aclsparseDnVecDescr_t Input/output dense vector descriptor (created by aclsparseCreateDnVec), whose values is a device pointer serving as the write target, host memory

Supported Data Types of Atlas A2 Products and Atlas A3 Products

Data Type aclDataType Description
INT8 ACL_INT8 8-bit signed integer, valSize = 1 byte
FP16 ACL_FLOAT16 Half-precision floating point, valSize = 2 bytes
BF16 ACL_BF16 bfloat16, valSize = 2 bytes
FP32 ACL_FLOAT Single-precision floating point, valSize = 4 bytes
COMPLEX64 ACL_COMPLEX64 Single-precision complex (2×fp32 interleaved storage), valSize = 8 bytes
Index Type aclsparseIndexType_t Description
I32 ACL_SPARSE_INDEX_32I 32-bit signed integer (Atlas A2 products and Atlas A3 products support only this type)
Index Base aclsparseIndexBase_t Description
ZERO ACL_SPARSE_INDEX_BASE_ZERO 0-based index; indices[i] is used directly as the offset of Y
ONE ACL_SPARSE_INDEX_BASE_ONE 1-based index; 1 is subtracted when accessing Y internally

The arch22 (DAV_2201) implementation of Atlas A2 products and Atlas A3 products requires that vecX.valueType be consistent with vecY.valueType and be within the five dtypes in the preceding table; otherwise, ACL_SPARSE_STATUS_INVALID_VALUE is returned.

Supported Data Types of Ascend 950PR&950DT Products

Data Type aclDataType Description
FP32 ACL_FLOAT Single-precision floating point, valSize = 4 bytes
FP16 ACL_FLOAT16 Half-precision floating point, valSize = 2 bytes
BF16 ACL_BF16 bfloat16, valSize = 2 bytes
Index Type aclsparseIndexType_t Description
I32 ACL_SPARSE_INDEX_32I 32-bit signed integer
I64 ACL_SPARSE_INDEX_64I 64-bit signed integer
Index Base aclsparseIndexBase_t Description
ZERO ACL_SPARSE_INDEX_BASE_ZERO 0-based index; indices[i] is used directly as the offset of Y
ONE ACL_SPARSE_INDEX_BASE_ONE 1-based index; 1 is subtracted when accessing Y internally

vecX.valueType must be consistent with vecY.valueType; otherwise, ACL_SPARSE_STATUS_NOT_SUPPORTED is returned.

Constraints for Atlas A2 Products and Atlas A3 Products

  • None of handle, vecX, or vecY can be nullptr; otherwise, ACL_SPARSE_STATUS_HANDLE_IS_NULLPTR is returned
  • The caller must call aclsparseSetStream to set the stream for handle first
  • When nnz == 0, ACL_SPARSE_STATUS_SUCCESS is returned directly and vecY remains unchanged. When nnz > 0, the indices/values of vecX and the values of vecY cannot be nullptr
  • Host verification chain (invalid parameters are intercepted before the synchronous return, and no kernel is launched): nnz > 0 with vecX.size == 0 or vecX.size > vecY.nums, null pointers, undeclared input/output alias, invalid idxType/idxBase/valueType, or vecX.valueType != vecY.valueType all return ACL_SPARSE_STATUS_INVALID_VALUE
  • Support scope of the current implementation (the arch22 delivery implementation of Atlas A2 products and Atlas A3 products, consistent with the in-repo sparse/scatter/arch22/ code):
    • The index type (idxType) of vecX supports only ACL_SPARSE_INDEX_32I (the kernel reads indices as int32); ACL_SPARSE_INDEX_64I is not yet supported
    • The value type (valueType) of vecX is consistent with the value type (valueType) of vecY, and only ACL_INT8 / ACL_FLOAT16 / ACL_BF16 / ACL_FLOAT / ACL_COMPLEX64 are supported (complex64 is 2×fp32 interleaved storage)
    • The index base (idxBase) supports ACL_SPARSE_INDEX_BASE_ZERO and ACL_SPARSE_INDEX_BASE_ONE (when ONE, 1 is subtracted when accessing Y internally)
  • Index value range: indices[i] - idxBase must be within the range [0, vecY.nums). The kernel directly uses the converted index as the GM offset of vecY for writing, and device-side out-of-range access is handled by the asynchronous error protocol or as a caller precondition (the host does not return synchronously). The caller must guarantee it by itself
  • vecX.size must be >= nnz (verified by aclsparseCreateSpVec)
  • Index order and duplicates (determinism policy): indices can be unsorted. When there are no duplicate indexes, the output is deterministically bit-wise consistent.
    • This operator is non-computational and requires bit-exact results. The kernel uses multi-core concurrency, and each core independently writes its own shard to GM. When indexes are distinct, the GM addresses written by each core do not overlap, and the result is deterministic and bit-wise consistent.
    • If indices contains duplicate elements, multiple cores concurrently write the same GM address, and the final written value is one of the corresponding input values (last-write-wins, not accumulated). The order is determined by inter-core scheduling, and the result is non-deterministic (under cuSPARSE semantics, duplicate indexes are undefined anyway). For deterministic results, the caller should ensure that indexes are distinct.
    • Ascending contiguous index segments hit the internal run-length fast copy path of the kernel and obtain better performance. Deduplicated ordered indexes are a performance recommendation, not a correctness precondition.

Constraints for Ascend 950PR&950DT Products

shape constraints:

  • vecX.nnz >= 0, vecX.size >= 0, and vecY.nums >= 0.
  • vecX.size <= vecY.nums (the size of the sparse vector must not exceed the length of the dense vector). Violation returns ACL_SPARSE_STATUS_INVALID_VALUE.
  • vecX.nnz <= vecX.size (the number of non-zero elements must not exceed the vector size). Violation returns ACL_SPARSE_STATUS_INVALID_VALUE.
  • vecX.nnz must not exceed UINT32_MAX (limited by the multi-core partitioning parameter type). Violation returns ACL_SPARSE_STATUS_NOT_SUPPORTED.

dtype constraints:

  • vecX.valueType must be one of ACL_FLOAT / ACL_FLOAT16 / ACL_BF16; otherwise, ACL_SPARSE_STATUS_NOT_SUPPORTED is returned.
  • vecX.idxType must be one of ACL_SPARSE_INDEX_32I / ACL_SPARSE_INDEX_64I; otherwise, ACL_SPARSE_STATUS_NOT_SUPPORTED is returned.
  • vecX.idxBase must be one of ACL_SPARSE_INDEX_BASE_ZERO / ACL_SPARSE_INDEX_BASE_ONE; otherwise, ACL_SPARSE_STATUS_INVALID_VALUE is returned.
  • vecX.valueType == vecY.valueType; otherwise, ACL_SPARSE_STATUS_NOT_SUPPORTED is returned.

pointer constraints:

  • handle cannot be nullptr; otherwise, ACL_SPARSE_STATUS_HANDLE_IS_NULLPTR is returned. The caller must call aclsparseSetStream first to bind the stream; otherwise, ACL_SPARSE_STATUS_INVALID_VALUE is returned.
  • The vecX and vecY descriptors cannot be nullptr; otherwise, ACL_SPARSE_STATUS_INVALID_VALUE is returned.
  • When nnz > 0, none of vecX.indices, vecX.values, or vecY.values can be nullptr; otherwise, ACL_SPARSE_STATUS_INVALID_VALUE is returned.
  • When nnz == 0, the data pointers are not accessed, and the API quickly returns success.

Alignment constraints: vecX.indices, vecX.values, and vecY.values must be aligned to 16 bytes (aligned with cuSPARSE). This is guaranteed by the descriptor creation side, and the kernel side does not verify it.

Input data contract (caller precondition): vecX.indices[i] - idxBase ∈ [0, vecY.nums). The operator does not validate index values at runtime (the host side cannot read device memory), and out-of-range access behavior is undefined, with consequences borne by the caller. This is consistent with the cuSPARSE behavior.

Duplicate indexes: when duplicate values exist in indices, multiple writes compete for the same position, and the final value depends on the thread scheduling order. The behavior is non-deterministic (last-write-wins). For deterministic results, the caller should ensure that indexes in indices are distinct.

Asynchronous execution: the function executes asynchronously, returns immediately after the kernel is enqueued to the stream associated with handle, and the result may not be ready yet. After the call, synchronize through aclrtSynchronizeStream(stream) before reading vecY.values.

workspace: this operator does not need a workspace and has no additional device memory allocation.

Platform constraints: the kernel uses SIMT (__simt_vf__ / asc_vf_call) thread-level parallelism, and the target architecture is arch35 / Ascend 950PR&950DT products. Other chips are not supported.

Returns

Return Value Meaning
ACL_SPARSE_STATUS_SUCCESS Execution succeeds (including the nnz == 0 quick return path)
ACL_SPARSE_STATUS_HANDLE_IS_NULLPTR handle is nullptr
ACL_SPARSE_STATUS_INVALID_VALUE vecX / vecY is nullptr; the idxBase enum is invalid; vecX.size > vecY.nums; vecX.nnz > vecX.size; indices / values / vecY.values is nullptr when nnz > 0; the stream is not bound
ACL_SPARSE_STATUS_NOT_SUPPORTED valueType is out of {FP32, FP16, BF16}; idxType is out of {I32, I64}; vecX.valueType != vecY.valueType; nnz > UINT32_MAX
ACL_SPARSE_STATUS_INTERNAL_ERROR GetAivCoreCount() returns 0 (device exception)

Invocation example

The example code is for reference only. For details about compilation and execution, see Compiling and Running a Sample.

#include <cstdint>
#include <cstdio>
#include <memory>
#include <vector>

#include "acl/acl.h"
#include "cann_ops_sparse.h"

#define CHECK_RET(cond, return_expr) \
    do {                             \
        if (!(cond)) {               \
            return_expr;             \
        }                            \
    } while (0)

#define LOG_PRINT(message, ...)         \
    do {                                \
        printf(message, ##__VA_ARGS__); \
    } while (0)

class AclContext {
public:
    explicit AclContext(int32_t deviceId) : deviceId_(deviceId) {}

    ~AclContext()
    {
        if (stream_ != nullptr) {
            aclrtDestroyStream(stream_);
            stream_ = nullptr;
        }
        if (deviceSet_) {
            aclrtResetDevice(deviceId_);
            deviceSet_ = false;
        }
        if (aclInited_) {
            aclFinalize();
            aclInited_ = false;
        }
    }

    int Init()
    {
        auto ret = aclInit(nullptr);
        CHECK_RET(ret == ACL_SUCCESS, LOG_PRINT("aclInit failed. ERROR: %d\n", ret); return ret);
        aclInited_ = true;

        ret = aclrtSetDevice(deviceId_);
        CHECK_RET(ret == ACL_SUCCESS, LOG_PRINT("aclrtSetDevice failed. ERROR: %d\n", ret); return ret);
        deviceSet_ = true;

        ret = aclrtCreateStream(&stream_);
        CHECK_RET(ret == ACL_SUCCESS, LOG_PRINT("aclrtCreateStream failed. ERROR: %d\n", ret); return ret);
        return ACL_SUCCESS;
    }

    aclrtStream Stream() const { return stream_; }

private:
    int32_t deviceId_;
    aclrtStream stream_ = nullptr;
    bool aclInited_ = false;
    bool deviceSet_ = false;
};

// Device memory smart pointer: with an aclrtFree deleter, automatically released when leaving the scope
using DevicePtr = std::unique_ptr<void, aclError (*)(void *)>;

// Descriptor smart pointers: with Destroy deleters, automatically destroyed when leaving the scope, no leak on error paths
using ConstSpVecPtr = std::unique_ptr<const aclsparseSpVecDescr,
    aclsparseStatus_t (*)(aclsparseConstSpVecDescr_t)>;
using DnVecPtr = std::unique_ptr<aclsparseDnVecDescr,
    aclsparseStatus_t (*)(aclsparseConstDnVecDescr_t)>;

// Helper: allocate device memory, and return a null pointer on failure
// ACL_MEM_MALLOC_HUGE_FIRST prefers huge page memory (HugePage), which can improve HBM read/write bandwidth
static DevicePtr MallocDevice(size_t sizeBytes)
{
    void *rawPtr = nullptr;
    auto ret = aclrtMalloc(&rawPtr, sizeBytes, ACL_MEM_MALLOC_HUGE_FIRST);
    CHECK_RET(ret == ACL_SUCCESS,
              LOG_PRINT("aclrtMalloc failed. ERROR: %d\n", ret);
              return DevicePtr(nullptr, aclrtFree));
    return DevicePtr(rawPtr, aclrtFree);
}

// Helper: allocate device memory and copy host data, and return a null pointer on failure
static DevicePtr AllocAndCopyDevice(const void *hostPtr, size_t sizeBytes)
{
    DevicePtr devPtr = MallocDevice(sizeBytes);
    CHECK_RET(devPtr != nullptr, return DevicePtr(nullptr, aclrtFree));
    if (hostPtr != nullptr && sizeBytes > 0) {
        auto ret = aclrtMemcpy(devPtr.get(), sizeBytes, hostPtr, sizeBytes, ACL_MEMCPY_HOST_TO_DEVICE);
        CHECK_RET(ret == ACL_SUCCESS,
                  LOG_PRINT("aclrtMemcpy H2D failed. ERROR: %d\n", ret);
                  return DevicePtr(nullptr, aclrtFree));
    }
    return devPtr;
}

int aclsparseScatterTest(AclContext &ctx)
{
    aclrtStream stream = ctx.Stream();

    // 1. Create the ops-sparse handle
    aclsparseHandle_t rawHandle = nullptr;
    auto sparseRet = aclsparseCreate(&rawHandle);
    CHECK_RET(sparseRet == ACL_SPARSE_STATUS_SUCCESS, LOG_PRINT("aclsparseCreate failed: %d\n", sparseRet);
              return sparseRet);
    std::unique_ptr<aclsparseContext, aclsparseStatus_t (*)(aclsparseHandle_t)> handlePtr(rawHandle, aclsparseDestroy);
    sparseRet = aclsparseSetStream(handlePtr.get(), stream);
    CHECK_RET(sparseRet == ACL_SPARSE_STATUS_SUCCESS, LOG_PRINT("aclsparseSetStream failed: %d\n", sparseRet);
              return sparseRet);

    // 2. Prepare host-side data
    //    Sparse vector X: size=8, nnz=4, FP32, I32, 0-based index
    //    Dense vector Y: nums=8, FP32
    //
    //    X.indices = [0, 2, 5, 7]
    //    X.values  = [1.0, 2.0, 3.0, 4.0]
    //    Initial Y = [10.0, 10.0, 10.0, 10.0, 10.0, 10.0, 10.0, 10.0]
    //
    //    Expected Y after scatter:
    //    Y[0]=1.0, Y[2]=2.0, Y[5]=3.0, Y[7]=4.0, and other positions keep 10.0
    //    Y = [1.0, 10.0, 2.0, 10.0, 10.0, 3.0, 10.0, 4.0]
    int64_t size  = 8;
    int64_t nnz   = 4;
    int64_t nums  = 8;

    std::vector<int32_t> hIndices = {0, 2, 5, 7};
    std::vector<float>   hXValues = {1.0f, 2.0f, 3.0f, 4.0f};
    std::vector<float>   hYValues = {10.0f, 10.0f, 10.0f, 10.0f, 10.0f, 10.0f, 10.0f, 10.0f};

    // 3. Copy data to the device (DevicePtr automatically manages release, no leak on error paths)
    DevicePtr dIndices = AllocAndCopyDevice(hIndices.data(), nnz * sizeof(int32_t));
    CHECK_RET(dIndices != nullptr, LOG_PRINT("AllocAndCopyDevice dIndices failed\n");
              return ACL_SPARSE_STATUS_INTERNAL_ERROR);
    DevicePtr dXValues = AllocAndCopyDevice(hXValues.data(), nnz * sizeof(float));
    CHECK_RET(dXValues != nullptr, LOG_PRINT("AllocAndCopyDevice dXValues failed\n");
              return ACL_SPARSE_STATUS_INTERNAL_ERROR);
    DevicePtr dYValues = AllocAndCopyDevice(hYValues.data(), nums * sizeof(float));
    CHECK_RET(dYValues != nullptr, LOG_PRINT("AllocAndCopyDevice dYValues failed\n");
              return ACL_SPARSE_STATUS_INTERNAL_ERROR);

    // 4. Create the sparse vector descriptor vecX (const, read-only) and the dense vector descriptor vecY (output)
    //    The descriptors are managed by ConstSpVecPtr / DnVecPtr RAII and automatically destroyed when CHECK_RET returns early
    aclsparseConstSpVecDescr_t vecX = nullptr;
    sparseRet = aclsparseCreateConstSpVec(&vecX, size, nnz, dIndices.get(), dXValues.get(),
                                          ACL_SPARSE_INDEX_32I, ACL_SPARSE_INDEX_BASE_ZERO, ACL_FLOAT);
    CHECK_RET(sparseRet == ACL_SPARSE_STATUS_SUCCESS, LOG_PRINT("aclsparseCreateConstSpVec failed: %d\n", sparseRet);
              return sparseRet);
    ConstSpVecPtr vecXPtr(vecX, aclsparseDestroySpVec);

    aclsparseDnVecDescr_t vecY = nullptr;
    sparseRet = aclsparseCreateDnVec(&vecY, nums, dYValues.get(), ACL_FLOAT);
    CHECK_RET(sparseRet == ACL_SPARSE_STATUS_SUCCESS, LOG_PRINT("aclsparseCreateDnVec failed: %d\n", sparseRet);
              return sparseRet);
    DnVecPtr vecYPtr(vecY, aclsparseDestroyDnVec);

    // 5. Execute scatter: Y[X.indices[i]] = X.values[i]
    sparseRet = aclsparseScatter(handlePtr.get(), vecXPtr.get(), vecYPtr.get());
    CHECK_RET(sparseRet == ACL_SPARSE_STATUS_SUCCESS, LOG_PRINT("aclsparseScatter failed: %d\n", sparseRet);
              return sparseRet);

    // 6. Synchronize and wait for the computation to complete (asynchronous semantics; the caller is responsible for synchronization)
    auto aclRet = aclrtSynchronizeStream(stream);
    CHECK_RET(aclRet == ACL_SUCCESS, LOG_PRINT("aclrtSynchronizeStream failed. ERROR: %d\n", aclRet);
              return ACL_SPARSE_STATUS_EXECUTION_FAILED);

    // 7. Copy the result back to the host and print it
    std::vector<float> hResult(nums, 0.0f);
    aclRet = aclrtMemcpy(hResult.data(), nums * sizeof(float), dYValues.get(), nums * sizeof(float),
                         ACL_MEMCPY_DEVICE_TO_HOST);
    CHECK_RET(aclRet == ACL_SUCCESS, LOG_PRINT("aclrtMemcpy D2H failed. ERROR: %d\n", aclRet);
              return ACL_SPARSE_STATUS_EXECUTION_FAILED);

    LOG_PRINT("\nResult Y after scatter:\n  ");
    for (int64_t i = 0; i < nums; i++) {
        LOG_PRINT("%.1f ", hResult[i]);
    }
    LOG_PRINT("\n");

    // 8. Clean up: the descriptors are automatically destroyed by vecXPtr / vecYPtr, the handle is automatically destroyed by handlePtr,
    //    and the device memory is automatically released by DevicePtr
    return ACL_SPARSE_STATUS_SUCCESS;
}

int main()
{
    AclContext ctx(0);
    auto ret = ctx.Init();
    CHECK_RET(ret == ACL_SUCCESS, return ret);

    ret = aclsparseScatterTest(ctx);
    CHECK_RET(ret == ACL_SPARSE_STATUS_SUCCESS, LOG_PRINT("aclsparseScatterTest failed: %d\n", ret); return ret);
    return 0;
}

The expected output is as follows (example values on arch35):

Result Y after scatter:
  1.0 10.0 2.0 10.0 10.0 3.0 10.0 4.0 

The output demonstrates the scatter semantics: the positions specified by indices=[0,2,5,7] are overwritten by values=[1,2,3,4], and other positions keep the initial value 10.0 unchanged.

Alignment Description

This operator is aligned with the cuSPARSE cusparseScatter API and follows its semantics and behavior conventions:

Comparison Dimension cuSPARSE cusparseScatter This Operator aclsparseScatter
API style Generic API (descriptor mode: SpVec + DnVec) Generic API (descriptor mode: SpVec + DnVec)
Core semantics Y[X.indices[i]] = X.values[i] Y[X.indices[i]] = X.values[i]
idxBase handling Subtract 1 internally when ONE Subtract 1 internally when ONE (uniformly uses indices[i] - idxBase)
Index order Unsorted allowed Unsorted allowed
Duplicate indexes last-write-wins, non-deterministic last-write-wins, non-deterministic
Out-of-range indexes No runtime verification, undefined behavior No runtime verification, undefined behavior
nnz = 0 No operation Quick return, no kernel launched
Asynchronous execution Asynchronous, caller synchronizes Asynchronous, caller synchronizes
workspace None None
Value types FP32 / FP64 / FP16 / BF16 / INT8 / Complex, and so on FP32 / FP16 / BF16 (core subset; FP64/INT8/Complex are not yet implemented)
Index types I32 / I64 I32 / I64

Differences:

  • Value type range: the current implementation of this operator covers the core subset FP32 / FP16 / BF16 (confirmed in requirement document §2.4). FP64 / INT8 / Complex64 / Complex128 supported by cuSPARSE are not yet implemented and will be extended as needed.
  • Implementation architecture: cuSPARSE is implemented based on CUDA thread-level parallelism; this operator is implemented based on Ascend C SIMT (__simt_vf__ + grid-stride loop) thread-level parallelism, with equivalent semantics.
  • Precision: scatter is pure data movement (no computation). The output of this operator is bit-wise identical to X.values (bitwise exact), consistent with the cuSPARSE behavior.