Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix argument types in sincos #232

Merged
merged 2 commits into from
Aug 2, 2023
Merged

Fix argument types in sincos #232

merged 2 commits into from
Aug 2, 2023

Conversation

fjebaker
Copy link
Contributor

@fjebaker fjebaker commented Aug 1, 2023

Fix #229

I would add tests for these changes, but I'm not really sure where in the test suite to add them.

From the Apple developer manual, the sincos functions return the cosine
part via a reference argument `&T`. Changed the overrides to now return
both the sin and cosine components as a tuple.
@maleadt
Copy link
Member

maleadt commented Aug 1, 2023

Thanks!

Tests would go in here:

@testset "math" begin
a = ones(Float32,1)
a .* Float32(3.14)
bufferA = MtlArray{eltype(a),length(size(a)),Shared}(a)
vecA = unsafe_wrap(Vector{Float32}, pointer(bufferA), 1)
function intr_test(arr)
idx = thread_position_in_grid_1d()
arr[idx] = cos(arr[idx])
return nothing
end
@metal intr_test(bufferA)
synchronize()
@test vecA cos.(a)
function intr_test2(arr)
idx = thread_position_in_grid_1d()
arr[idx] = Metal.rsqrt(arr[idx])
return nothing
end
@metal intr_test2(bufferA)
end

@fjebaker
Copy link
Contributor Author

fjebaker commented Aug 1, 2023

Is this line needed?

a .* Float32(3.14)

@maleadt
Copy link
Member

maleadt commented Aug 2, 2023

Is this line needed?

a .* Float32(3.14)

I don't think so. Probably doesn't hurt either?

@maleadt maleadt merged commit df0b348 into JuliaGPU:main Aug 2, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Unable to compile trig functions through ForwardDiff
2 participants