-
Notifications
You must be signed in to change notification settings - Fork 13
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
Disable cl_khr_fp16 for the Environments unsupporting cl_khr_fp16 #266
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Test (commit 56efdba) failed in vega.
============================= test session starts ==============================
platform linux -- Python 3.6.5, pytest-4.3.0, py-1.8.1, pluggy-0.13.1
rootdir: /home/clpy-jenkins-slave/workspace/clpy_testing_vega, inifile: setup.cfg
collected 148 items
test_api.py . [ 0%]
test_atomicAdd.py .. [ 2%]
test_carray.py . [ 2%]
test_clblast.py ...................... [ 17%]
test_concatenate.py ........ [ 22%]
test_elementwise.py . [ 23%]
test_exception.py .. [ 25%]
test_linalg.py ... [ 27%]
test_memory.py ............. [ 35%]
test_ndarray.py .................... [ 49%]
test_reduction.py .............. [ 58%]
test_rollaxis.py ... [ 60%]
test_sample_rand.py ... [ 62%]
headercvt_tests/test_headercvt_funcdecl.py .. [ 64%]
headercvt_tests/test_headercvt_preproc_defines.py .. [ 65%]
headercvt_tests/test_headercvt_types.py .............. [ 75%]
ultima_tests/test_cast.py .... [ 77%]
ultima_tests/test_cindexer.py .. [ 79%]
ultima_tests/test_constructor.py ........... [ 86%]
ultima_tests/test_half.py .FF. [ 89%]
ultima_tests/test_overload.py .... [ 91%]
ultima_tests/test_template.py ........ [ 97%]
ultima_tests/test_ultima_carray.py .... [100%]
=================================== FAILURES ===================================
______________________ TestUltimaHalfTrick.test_clpy_half ______________________
self = <test_half.TestUltimaHalfTrick testMethod=test_clpy_half>
def test_clpy_half(self):
x = '''
void f()
{
__clpy__half half_ = 42.F;
int __clpy__half = half_;
}
'''
y = clpy.backend.ultima.exec_ultima(
'''
void f(){
__clpy__half half_ = 42.f;
int __clpy__half = half_;
}
> ''')
... and more 72 lines
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Test (commit 56efdba) failed in titanv.
============================= test session starts ==============================
platform linux -- Python 3.6.5, pytest-4.3.0, py-1.8.1, pluggy-0.13.1
rootdir: /home/clpy-jenkins-slave/workspace/clpy_testing_titan, inifile: setup.cfg
collected 148 items
test_api.py . [ 0%]
test_atomicAdd.py .. [ 2%]
test_carray.py . [ 2%]
test_clblast.py ...................... [ 17%]
test_concatenate.py ........ [ 22%]
test_elementwise.py . [ 23%]
test_exception.py .. [ 25%]
test_linalg.py ... [ 27%]
test_memory.py ............. [ 35%]
test_ndarray.py .................... [ 49%]
test_reduction.py .............. [ 58%]
test_rollaxis.py ... [ 60%]
test_sample_rand.py ... [ 62%]
headercvt_tests/test_headercvt_funcdecl.py .. [ 64%]
headercvt_tests/test_headercvt_preproc_defines.py .. [ 65%]
headercvt_tests/test_headercvt_types.py .............. [ 75%]
ultima_tests/test_cast.py .... [ 77%]
ultima_tests/test_cindexer.py .. [ 79%]
ultima_tests/test_constructor.py ........... [ 86%]
ultima_tests/test_half.py .FF. [ 89%]
ultima_tests/test_overload.py .... [ 91%]
ultima_tests/test_template.py ........ [ 97%]
ultima_tests/test_ultima_carray.py .... [100%]
=================================== FAILURES ===================================
______________________ TestUltimaHalfTrick.test_clpy_half ______________________
self = <test_half.TestUltimaHalfTrick testMethod=test_clpy_half>
def test_clpy_half(self):
x = '''
void f()
{
__clpy__half half_ = 42.F;
int __clpy__half = half_;
}
'''
y = clpy.backend.ultima.exec_ultima(
'''
void f(){
__clpy__half half_ = 42.f;
int __clpy__half = half_;
}
> ''')
... and more 72 lines
This reverts commit a1d49aa.
9cb6676
to
ae09728
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Test (commit b3482fe) failed in vega.
============================= test session starts ==============================
platform linux -- Python 3.6.5, pytest-4.3.0, py-1.8.1, pluggy-0.13.1
rootdir: /home/clpy-jenkins-slave/workspace/clpy_testing_vega, inifile: setup.cfg
collected 148 items
test_api.py . [ 0%]
test_atomicAdd.py .. [ 2%]
test_carray.py . [ 2%]
test_clblast.py ...................... [ 17%]
test_concatenate.py ........ [ 22%]
test_elementwise.py . [ 23%]
test_exception.py .. [ 25%]
test_linalg.py ... [ 27%]
test_memory.py ............. [ 35%]
test_ndarray.py .................... [ 49%]
test_reduction.py .............. [ 58%]
test_rollaxis.py ... [ 60%]
test_sample_rand.py ... [ 62%]
headercvt_tests/test_headercvt_funcdecl.py .. [ 64%]
headercvt_tests/test_headercvt_preproc_defines.py .. [ 65%]
headercvt_tests/test_headercvt_types.py .............. [ 75%]
ultima_tests/test_cast.py .... [ 77%]
ultima_tests/test_cindexer.py .. [ 79%]
ultima_tests/test_constructor.py ........... [ 86%]
ultima_tests/test_half.py .FF. [ 89%]
ultima_tests/test_overload.py .... [ 91%]
ultima_tests/test_template.py ........ [ 97%]
ultima_tests/test_ultima_carray.py .... [100%]
=================================== FAILURES ===================================
______________________ TestUltimaHalfTrick.test_clpy_half ______________________
self = <test_half.TestUltimaHalfTrick testMethod=test_clpy_half>
def test_clpy_half(self):
supports_cl_khr_fp16 = clpy.backend.opencl.env.supports_cl_khr_fp16()
options = ('-D__CLPY_ENABLE_CL_KHR_FP16'
if supports_cl_khr_fp16
else '', )
x = clpy.backend.ultima.exec_ultima('', '#include <cupy/carray.hpp>') + ('''
void f()
{
__clpy__half half_ = 42.F;
int __clpy__half = half_;
}
''' if supports_cl_khr_fp16 else '''
void f()
{
__clpy__half half_;constructor___clpy__half___left_paren____clpy__half_float__right_paren__(&half_, 42.F);
int __clpy__half = operatorfloat___clpy__half_(&half_);
... and more 53 lines
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Test (commit b3482fe) passed in titanv.
ae09728
to
d5e4865
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Test (commit 33338e8) passed in titanv.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Test (commit 33338e8) passed in vega.
The CI has passed. I hear that @ybsh will return to our development today (welcome back!).
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@@ -1,5 +1,7 @@ | |||
#pragma once | |||
#ifdef __CLPY_ENABLE_CL_KHR_FP16 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why didn't you just remove cl_khr_fp16 for all environments but disable it only if it doesn't support it?
Do you have any definite disadvantages or problems when you treat half as int16 on a cl_khr_fp16 machine? If yes, please leave comments on the code, otherwise (yet) please make the code simple.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think that it's better in performance to use half
implemented as hardware. If we will support all half
operations, the performance given from native half
in supported environments is more important.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we will support all half operations
We have not proven the ability neither decided to do that, must continue to discuss on #265 .
Then, until to decide it, the half performance is not important even if it has native half support.
Adding cl_khr_fp16
is now too superfluous to just disable it #264 .
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ushort v; | ||
__clpy__half_() = default; | ||
__clpy__half_(float f):v{convert_float_to_half_ushort(f)}{} | ||
operator float()const{return convert_half_ushort_to_float(v);} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I understand Ultima can solve the problem.
But I don't understand why you need Ultima. As I told you in the some old issue, you tend to solve everything by using Ultima but we must avoid it unless there's no solution without Ultima. Minimize Ultima to minimize maintenance difficulties.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually, I need the changes in this PR to ultima only for passing ultima_tests
.
If we decide to change the behavior of half
identifier, we doesn't need it.
However, we will need it to support all half
operations, so I proposed this changes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we decide to change the behavior of half
As of #266 (comment), no half
variable will be constructed by users. So you don't need Ultima.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As of #266 (comment), no
half
variable will be constructed by users.
Until to decide to support all half
operations . OK.
Then, when you
decide to change the behavior of
half
identifier
? Again, we need to decide to change the behavior of half
identifier from current ClPy to disable cl_khr_fp16
without Ultima. It means that we need to fix or disable some tests. If you have already decided it in your own, you should indicate your opinion here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Test (commit 7ee88ab) passed in titanv.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Test (commit 7ee88ab) passed in vega.
@LWisteria I commented your questions and fixed the code you reviewed. |
@vorj After our offline discussion, we concluded that we must focus on just removing However, your commits on this PR are valuable to store our commit history. So I want you not to make new branch/PR but to continue on this branch/PR and remove inessentials. |
It is quite different to just remove |
After #269, this PR is obsolete. I'm closing but not deleting this branch for the further development. |
Tasks of #264 , and #265 .
ClPy in this PR checks that the device supports
cl_khr_fp16
or not, then enable or disablecl_khr_fp16
.When
cl_khr_fp16
isn't supported on the device, the ClPy uses a fallback implementation ofhalf
, which doesn't requirecl_khr_fp16
.This PR also contains below changes:
half
half
type, so it makes little impact.