Tensor Operations
AMDGPU.jl now provides wrappers for the hipTensor library, which can be used to perform operations on high-dimensional arrays. However, there are some caveats:
hipTensorisn't supported on every AMD GPU. You can find the list of supported GPUs at thehipTensordocumentation.for
hiptensorCreateElementwiseTrinary,hipTENSOR2.2 has the two binary operators the wrong way round: it applies the operator passed asopABCtoAandB, and the one passed asopABto that intermediate result andC. This is currently handled by our wrapper.Unlike NVIDIA's
cuTENSOR,hipTENSORwants a complex compute descriptor for complex operands: pairing e.g.ComplexF32tensors withHIPTENSOR_COMPUTE_DESC_32FmakeshiptensorCreatePlanfail withHIPTENSOR_STATUS_EXECUTION_FAILEDfrom
hipTENSOR2.4 on, a contraction is only computed correctly when every operand is packed column-major and indexed with the free modes before the contracted ones:A = [M…, K…],B = [N…, K…],C = D = [M…, N…]. Other layouts come back wrong with no error reported, soplan_contractionrejects them with anArgumentError— permute the operands withpermutedimsfirston
hipTENSOR2.4,HIPTENSOR_OP_CONJon a contraction's input makeshiptensorCreatePlanfail withHIPTENSOR_STATUS_EXECUTION_FAILED