Skip to content

Commit 68c3a00

Browse files
Automatic ITensorFormatter run (#1700)
Co-authored-by: mtfishman <7855256+mtfishman@users.noreply.github.com> Co-authored-by: Matt Fishman <mtfishman@users.noreply.github.com> Co-authored-by: mtfishman <mfishman@flatironinstitute.org>
1 parent fbfb2b7 commit 68c3a00

210 files changed

Lines changed: 1885 additions & 1468 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

NDTensors/Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name = "NDTensors"
22
uuid = "23ae76d9-e61a-49c4-8f12-3f1a16adf9cf"
33
authors = ["Matthew Fishman <mfishman@flatironinstitute.org>"]
4-
version = "0.4.18"
4+
version = "0.4.19"
55

66
[deps]
77
Accessors = "7d9f7c33-5ae7-4f3b-8dc6-eff91059b697"

NDTensors/ext/NDTensorsAMDGPUExt/adapt.jl

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
using NDTensors: NDTensors, EmptyStorage, adapt_storagetype, emptytype
1+
using AMDGPU: AMDGPU, ROCArray, ROCVector
2+
using Adapt: Adapt, adapt
3+
using Functors: fmap
24
using NDTensors.AMDGPUExtensions: AMDGPUExtensions, ROCArrayAdaptor
35
using NDTensors.GPUArraysCoreExtensions: storagemode
46
using NDTensors.Vendored.TypeParameterAccessors:
57
default_type_parameters, set_type_parameters, type_parameters
6-
using Adapt: Adapt, adapt
7-
using AMDGPU: AMDGPU, ROCArray, ROCVector
8-
using Functors: fmap
8+
using NDTensors: NDTensors, EmptyStorage, adapt_storagetype, emptytype
99

1010
function AMDGPUExtensions.roc(
1111
xs; storagemode = default_type_parameters(ROCArray, storagemode)

NDTensors/ext/NDTensorsAMDGPUExt/copyto.jl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
using NDTensors.Expose: Exposed, expose, parent, unexpose
2-
using LinearAlgebra: LinearAlgebra, Adjoint
31
using AMDGPU: ROCArray
2+
using LinearAlgebra: LinearAlgebra, Adjoint
3+
using NDTensors.Expose: Exposed, expose, parent, unexpose
44

55
# Same definition as `MtlArray`.
66
function Base.copy(src::Exposed{<:ROCArray, <:Base.ReshapedArray})
@@ -10,7 +10,7 @@ end
1010
function Base.copy(
1111
src::Exposed{
1212
<:ROCArray, <:SubArray{<:Any, <:Any, <:Base.ReshapedArray{<:Any, <:Any, <:Adjoint}},
13-
},
13+
}
1414
)
1515
return copy(@view copy(expose(parent(src)))[parentindices(unexpose(src))...])
1616
end

NDTensors/ext/NDTensorsAMDGPUExt/linearalgebra.jl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1+
using AMDGPU: ROCMatrix
2+
using Adapt: adapt
3+
using LinearAlgebra: svd
14
using NDTensors.AMDGPUExtensions: roc
25
using NDTensors.Expose: Expose, Exposed, expose, ql, ql_positive
36
using NDTensors.GPUArraysCoreExtensions: cpu
47
using NDTensors.Vendored.TypeParameterAccessors: unwrap_array_type
5-
using LinearAlgebra: svd
6-
using Adapt: adapt
7-
using AMDGPU: ROCMatrix
88

99
function LinearAlgebra.svd(A::Exposed{<:ROCMatrix}; kwargs...)
1010
U, S, V = svd(cpu(A))

NDTensors/ext/NDTensorsAMDGPUExt/mul.jl

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
1-
using NDTensors.Expose: Exposed, expose, parent, unexpose
2-
using LinearAlgebra: LinearAlgebra, Adjoint, Transpose, mul!
31
using AMDGPU: ROCArray
2+
using LinearAlgebra: LinearAlgebra, Adjoint, Transpose, mul!
3+
using NDTensors.Expose: Exposed, expose, parent, unexpose
44

55
# This was calling generic matrix multiplication.
66
function LinearAlgebra.mul!(
77
CM::Exposed{<:ROCArray, <:LinearAlgebra.Transpose},
88
AM::Exposed{<:ROCArray},
99
BM::Exposed{<:ROCArray},
1010
α,
11-
β,
11+
β
1212
)
1313
mul!(transpose(CM), transpose(BM), transpose(AM), α, β)
1414
return unexpose(CM)
@@ -20,7 +20,7 @@ function LinearAlgebra.mul!(
2020
AM::Exposed{<:ROCArray},
2121
BM::Exposed{<:ROCArray},
2222
α,
23-
β,
23+
β
2424
)
2525
mul!(CM', BM', AM', α, β)
2626
return unexpose(CM)
@@ -38,7 +38,7 @@ function LinearAlgebra.mul!(
3838
},
3939
},
4040
α,
41-
β,
41+
β
4242
)
4343
mul!(CM, AM, expose(transpose(copy(expose(parent(BM))))), α, β)
4444
return unexpose(CM)

NDTensors/ext/NDTensorsAMDGPUExt/permutedims.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
using NDTensors.Expose: Exposed, expose, parent, unexpose
21
using AMDGPU: ROCArray
2+
using NDTensors.Expose: Exposed, expose, parent, unexpose
33

44
function Base.permutedims!(
55
Edest::Exposed{<:ROCArray, <:Base.ReshapedArray}, Esrc::Exposed{<:ROCArray}, perm
@@ -15,7 +15,7 @@ function Base.permutedims!(
1515
Edest::Exposed{<:ROCArray, <:Base.ReshapedArray{<:Any, <:Any, <:Adjoint}},
1616
Esrc::Exposed{<:ROCArray},
1717
perm,
18-
f,
18+
f
1919
)
2020
Aperm = reshape(permutedims(Esrc, perm), size(parent(Edest)))
2121
parent(Edest) .= f.(parent(Edest), Aperm)
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
using AMDGPU: ROCArray
22
using NDTensors.GPUArraysCoreExtensions: storagemode
3-
using NDTensors.Vendored.TypeParameterAccessors: TypeParameterAccessors, Position
3+
using NDTensors.Vendored.TypeParameterAccessors: Position, TypeParameterAccessors
44

55
TypeParameterAccessors.position(::Type{<:ROCArray}, ::typeof(storagemode)) = Position(3)

NDTensors/ext/NDTensorsCUDAExt/adapt.jl

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
using Adapt: Adapt
22
using CUDA: CUDA, CuArray, CuVector
33
using Functors: fmap
4-
using NDTensors: NDTensors, EmptyStorage, adapt_storagetype, emptytype
54
using NDTensors.CUDAExtensions: CUDAExtensions, CuArrayAdaptor
65
using NDTensors.GPUArraysCoreExtensions: storagemode
76
using NDTensors.Vendored.TypeParameterAccessors:
87
default_type_parameters, set_type_parameters, type_parameters
8+
using NDTensors: NDTensors, EmptyStorage, adapt_storagetype, emptytype
99

1010
function CUDAExtensions.cu(xs; storagemode = default_type_parameters(CuArray, storagemode))
1111
return fmap(x -> adapt(CuArrayAdaptor{storagemode}(), x), xs)
@@ -21,6 +21,7 @@ end
2121
function NDTensors.adapt_storagetype(
2222
adaptor::CuArrayAdaptor, ::Type{EmptyStorage{ElT, StoreT}}
2323
) where {ElT, StoreT}
24-
cutype = set_type_parameters(CuVector, (eltype, storagemode), (ElT, storagemode(adaptor)))
24+
cutype =
25+
set_type_parameters(CuVector, (eltype, storagemode), (ElT, storagemode(adaptor)))
2526
return emptytype(adapt_storagetype(cutype, StoreT))
2627
end

NDTensors/ext/NDTensorsCUDAExt/copyto.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
using CUDA: CuArray
2-
using NDTensors.Expose: Exposed, expose, unexpose
32
using LinearAlgebra: Adjoint
3+
using NDTensors.Expose: Exposed, expose, unexpose
44

55
# Same definition as `MtlArray`.
66
function Base.copy(src::Exposed{<:CuArray, <:Base.ReshapedArray})
@@ -10,7 +10,7 @@ end
1010
function Base.copy(
1111
src::Exposed{
1212
<:CuArray, <:SubArray{<:Any, <:Any, <:Base.ReshapedArray{<:Any, <:Any, <:Adjoint}},
13-
},
13+
}
1414
)
1515
return copy(@view copy(expose(parent(src)))[parentindices(unexpose(src))...])
1616
end

NDTensors/ext/NDTensorsCUDAExt/indexing.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
using CUDA: CuArray
22
using GPUArraysCore: @allowscalar
3-
using NDTensors: NDTensors
43
using NDTensors.Expose: Exposed, expose, unexpose
4+
using NDTensors: NDTensors
55

66
function Base.getindex(E::Exposed{<:CuArray})
77
return @allowscalar unexpose(E)[]

0 commit comments

Comments
 (0)