@@ -44,94 +44,4 @@ function TensorOperations._butensor(src, ex...)
44
44
return return Base. remove_linenums! (newex)
45
45
end
46
46
47
- @static if VERSION >= v " 1.11"
48
- if PrecompileTools. workload_enabled (@__MODULE__ )
49
- buf = typeof (Bumper. default_buffer ())
50
- backend = TensorOperations. DefaultBackend
51
-
52
- # tensoradd!
53
- # ----------
54
- for T in TensorOperations. PRECOMPILE_ELTYPES
55
- for N in 0 : (TensorOperations. PRECOMPILE_ADD_NDIMS)
56
- TA = Array{T,N}
57
- pA = Index2Tuple{N,0 }
58
- TA_buf = UnsafeArray{T,N}
59
- for (C, A) in Iterators. product ((TA, TA_buf), (TA, TA_buf))
60
- C == A == TA && continue
61
- precompile (tensoradd!, (C, A, pA, Bool, One, Zero))
62
- precompile (tensoradd!, (C, A, pA, Bool, T, Zero))
63
- precompile (tensoradd!, (C, A, pA, Bool, T, T))
64
- end
65
-
66
- for (A, istemp) in Iterators. product ((TA, TA_buf), (Val{true }, Val{false }))
67
- precompile (tensoralloc_add, (T, A, pA, Bool, istemp, buf))
68
- end
69
- end
70
- end
71
-
72
- # tensortrace!
73
- # ------------
74
- for T in TensorOperations. PRECOMPILE_ELTYPES
75
- for N1 in 0 : TensorOperations. PRECOMPILE_TRACE_NDIMS[1 ],
76
- N2 in 0 : TensorOperations. PRECOMPILE_TRACE_NDIMS[2 ]
77
-
78
- TC = Array{T,N1}
79
- TA = Array{T,N1 + 2 N2}
80
- p = Index2Tuple{N1,0 }
81
- q = Index2Tuple{N2,N2}
82
- r = Index2Tuple{N1 + 2 N2,0 }
83
-
84
- TA_buf = UnsafeArray{T,N1 + 2 N2}
85
- TC_buf = UnsafeArray{T,N1}
86
-
87
- for (C, A) in Iterators. product ((TC, TC_buf), (TA, TA_buf))
88
- C == TC && A == TA && continue
89
- precompile (tensortrace!, (C, A, p, q, Bool, One, Zero))
90
- precompile (tensortrace!, (C, A, p, q, Bool, T, Zero))
91
- precompile (tensortrace!, (C, A, p, q, Bool, T, T))
92
- end
93
-
94
- # allocation re-uses tensoralloc_add
95
- end
96
- end
97
-
98
- # tensorcontract!
99
- # ---------------
100
- for T in TensorOperations. PRECOMPILE_ELTYPES
101
- for N1 in 0 : TensorOperations. PRECOMPILE_CONTRACT_NDIMS[1 ],
102
- N2 in 0 : TensorOperations. PRECOMPILE_CONTRACT_NDIMS[2 ],
103
- N3 in 0 : TensorOperations. PRECOMPILE_CONTRACT_NDIMS[1 ]
104
-
105
- NA = N1 + N2
106
- NB = N2 + N3
107
- NC = N1 + N3
108
- TC, TA, TB = Array{T,NC}, Array{T,NA}, Array{T,NB}
109
- pA = Index2Tuple{N1,N2}
110
- pB = Index2Tuple{N2,N3}
111
- pAB = Index2Tuple{NC,0 }
112
-
113
- TC_buf = UnsafeArray{T,NC}
114
- TA_buf = UnsafeArray{T,NA}
115
- TB_buf = UnsafeArray{T,NB}
116
- for (C, A, B) in Iterators. product ((TC, TC_buf), (TA, TA_buf), (TB, TB_buf))
117
- precompile (tensorcontract!,
118
- (C, A, pA, Bool, B, pB, Bool, pAB, One, Zero, backend,
119
- buf))
120
- precompile (tensorcontract!,
121
- (C, A, pA, Bool, B, pB, Bool, pAB, T, Zero, backend,
122
- buf))
123
- precompile (tensorcontract!,
124
- (C, A, pA, Bool, B, pB, Bool, pAB, T, T, backend, buf))
125
- end
126
-
127
- for (A, B, istemp) in
128
- Iterators. product ((TA, TA_buf), (TB, TB_buf), (Val{true }, Val{false }))
129
- precompile (tensoralloc_contract,
130
- (T, A, pA, Bool, B, pB, Bool, pAB, istemp, buf))
131
- end
132
- end
133
- end
134
- end
135
- end
136
-
137
47
end
0 commit comments