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 cuTENSOR contractions not working for FP16 inputs #1238

Merged
merged 2 commits into from
Nov 10, 2021

Conversation

thomasfaingnaert
Copy link
Member

Contractions for FP16 inputs with Volta Tensor Cores (typeA = CUDA_R_16F, typeB = CUDA_R_16F, typeC = CUDA_R_16F, typeCompute = CUTENSOR_COMPUTE_32F) didn't work before, due to a missing case in scalar_types in lib/cutensor/wrappers.jl:

ERROR: KeyError: key (Float16, Float32) not found
Stacktrace:
 [1] getindex(h::Dict{Tuple{DataType, DataType}, DataType}, key::Tuple{DataType, DataType})                                                                  
   @ Base ./dict.jl:482
 [2] plan_contraction(A::Union{CuArray, Array}, Ainds::Vector{Char}, opA::CUDA.CUTENSOR.cutensorOperator_t, B::Union{CuArray, Array}, Binds::Vector{Char}, opB::CUDA.CUTENSOR.cutensorOperator_t, C::Union{CuArray, Array}, Cinds::Vector{Char}, opC::CUDA.CUTENSOR.cutensorOperator_t, opOut::CUDA.CUTENSOR.cutensorOperator_t; pref::CUDA.CUTENSOR.cutensorWorksizePreference_t, algo::CUDA.CUTENSOR.cutensorAlgo_t, compute_type::Type)                                               
   @ CUDA.CUTENSOR ~/.julia/packages/CUDA/YpW0k/lib/cutensor/wrappers.jl:310

This PR fixes that, and also updates the testsuite accordingly.

@maleadt
Copy link
Member

maleadt commented Nov 10, 2021

Let's actually have this run the CUTENSOR test suite on CUDA 11.5 by rebasing after #1239 is merged.

@codecov
Copy link

codecov bot commented Nov 10, 2021

Codecov Report

Merging #1238 (e3cbbba) into master (8caad95) will increase coverage by 0.01%.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1238      +/-   ##
==========================================
+ Coverage   80.17%   80.19%   +0.01%     
==========================================
  Files         119      119              
  Lines        8390     8390              
==========================================
+ Hits         6727     6728       +1     
+ Misses       1663     1662       -1     
Impacted Files Coverage Δ
lib/cutensor/wrappers.jl 95.47% <ø> (ø)
src/accumulate.jl 100.00% <ø> (+2.94%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update c903144...e3cbbba. Read the comment docs.

@maleadt maleadt merged commit 73c4be0 into JuliaGPU:master Nov 10, 2021
@thomasfaingnaert thomasfaingnaert deleted the tf/fix-fp16-cutensor-contr branch November 11, 2021 10:29
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.

None yet

2 participants