Skip to content

Commit 2ef4562

Browse files
committed
Add complex retstyle test
1 parent bd691a1 commit 2ef4562

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

test/direct.jl

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -262,4 +262,25 @@ if MKL_jll.is_available() && Sys.ARCH == :x86_64
262262
@test result Float32(5.13)
263263
@test isempty(stacktraces)
264264
end
265+
266+
@testset "MKL complex retstyle" begin
267+
lbt_forward(lbt_handle, libmkl_rt; clear=true, suffix_hint = "64")
268+
269+
config = lbt_get_config(lbt_handle)
270+
libs = unpack_loaded_libraries(config)
271+
@test length(libs) == 1
272+
@test libs[1].interface == LBT_INTERFACE_ILP64
273+
@test libs[1].cblas == LBT_CBLAS_DIVERGENT
274+
@test libs[1].complex_retstyle == LBT_COMPLEX_RETSTYLE_ARGUMENT
275+
276+
# Call cblas_cdotc_sub64_ to test the full CBLAS workaround -> complex return style handling chain
277+
empty!(stacktraces)
278+
A = ComplexF32[3.1 + 1.4im, -1.0 + 1.2im]
279+
B = ComplexF32[1.3 + 0.3im, -1.1 + -3.4im]
280+
result = ComplexF32[0]
281+
cdotc_fptr = dlsym(lbt_handle, :cblas_cdotc_sub64_)
282+
ccall(cdotc_fptr, Cvoid, (Int64, Ptr{ComplexF64}, Int64, Ptr{ComplexF64}, Int64, Ptr{ComplexF64}), 2, A, 1, B, 1, result)
283+
@test result[1] ComplexF32(1.47 + 3.83im)
284+
@test isempty(stacktraces)
285+
end
265286
end

0 commit comments

Comments
 (0)