You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mxnet.apache.org by GitBox <gi...@apache.org> on 2021/04/19 05:41:18 UTC

[GitHub] [incubator-mxnet] Neutron3529 opened a new pull request #20188: try avoid the error in operator/tensor/amp_cast.h

Neutron3529 opened a new pull request #20188:
URL: https://github.com/apache/incubator-mxnet/pull/20188


   I'm trying to avoid the error generated by amp using bfloat16
   
   The error is due to:
   ```
   /me/prog/prog-amp.py:77: UserWarning: All children of this Sequential layer 'compose1_' are HybridBlocks. Consider using HybridSequential for the best performance.
     transform_test.hybridize(static_alloc=True,static_shape=True)
   Traceback (most recent call last):
     File "/me/prog/prog-amp.py", line 359, in <module>
       loss0   = loss_fn(output, label)
     File "/me/incubator-mxnet/python/mxnet/ndarray/ndarray.py", line 314, in __mul__
       return multiply(self, other)
     File "/me/incubator-mxnet/python/mxnet/ndarray/ndarray.py", line 3757, in multiply
       return _ufunc_helper(
     File "/me/incubator-mxnet/python/mxnet/ndarray/ndarray.py", line 3576, in _ufunc_helper
       return fn_array(lhs, rhs)
     File "/me/incubator-mxnet/python/mxnet/contrib/amp/amp.py", line 109, in _new_fun
       return f(*args, **kwargs)
     File "<string>", line 52, in broadcast_mul
     File "/me/incubator-mxnet/python/mxnet/_ctypes/ndarray.py", line 82, in _imperative_invoke
       check_call(_LIB.MXImperativeInvokeEx(
     File "/me/incubator-mxnet/python/mxnet/base.py", line 246, in check_call
       raise get_last_ffi_error()
   mxnet.base.MXNetError: Traceback (most recent call last):
     File "/me/incubator-mxnet/src/io/../operator/elemwise_op_common.h", line 135
   MXNetError: Check failed: assign(&dattr, vec.at(i)): Incompatible attr in node  at 1-th input: expected bfloat16, got float32
   Error in atexit._run_exitfuncs:
   Traceback (most recent call last):
     File "/me/incubator-mxnet/python/mxnet/base.py", line 587, in _notify_shutdown
       check_call(_LIB.MXNotifyShutdown())
     File "/me/incubator-mxnet/python/mxnet/base.py", line 246, in check_call
       raise get_last_ffi_error()
   mxnet.base.MXNetError: Traceback (most recent call last):
     File "/me/incubator-mxnet/src/operator/tensor/./amp_cast.h", line 136
   MXNetError: Unknown type enum 12
   ```
   which is tested under mxnet v1.x, but seems also affect v2.0
   
   since 30-series RTX card support bfloat16, there is no need to disable it using `#ifndef __NVCC__` explicitly, 
   
   I don't know whether it works, but things could not be worse.
   
   ## Description ##
   (Brief description on what this PR is about)
   
   ## Checklist ##
   ### Essentials ###
   - [ ] PR's title starts with a category (e.g. [BUGFIX], [MODEL], [TUTORIAL], [FEATURE], [DOC], etc)
   - [ ] Changes are complete (i.e. I finished coding on this PR)
   - [ ] All changes have test coverage
   - [ ] Code is well-documented
   
   ### Changes ###
   - [ ] Feature1, tests, (and when applicable, API doc)
   - [ ] Feature2, tests, (and when applicable, API doc)
   
   ## Comments ##
   - If this change is a backward incompatible change, why must this change be made.
   - Interesting edge cases to note here
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-mxnet] mxnet-bot commented on pull request #20188: [BUGFIX]try avoid the error in operator/tensor/amp_cast.h

Posted by GitBox <gi...@apache.org>.
mxnet-bot commented on pull request #20188:
URL: https://github.com/apache/incubator-mxnet/pull/20188#issuecomment-826123157


   Jenkins CI successfully triggered : [unix-gpu, unix-cpu, centos-cpu]


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-mxnet] Neutron3529 commented on pull request #20188: [BUGFIX]try avoid the error in operator/tensor/amp_cast.h

Posted by GitBox <gi...@apache.org>.
Neutron3529 commented on pull request #20188:
URL: https://github.com/apache/incubator-mxnet/pull/20188#issuecomment-826123141


   @mxnet-bot run ci [unix-gpu, unix-cpu, centos-cpu]


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-mxnet] Neutron3529 commented on pull request #20188: [BUGFIX]try avoid the error in operator/tensor/amp_cast.h

Posted by GitBox <gi...@apache.org>.
Neutron3529 commented on pull request #20188:
URL: https://github.com/apache/incubator-mxnet/pull/20188#issuecomment-826123141


   @mxnet-bot run ci [unix-gpu, unix-cpu, centos-cpu]


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-mxnet] mxnet-bot commented on pull request #20188: [BUGFIX]try avoid the error in operator/tensor/amp_cast.h

Posted by GitBox <gi...@apache.org>.
mxnet-bot commented on pull request #20188:
URL: https://github.com/apache/incubator-mxnet/pull/20188#issuecomment-826123157


   Jenkins CI successfully triggered : [unix-gpu, unix-cpu, centos-cpu]


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-mxnet] Neutron3529 commented on a change in pull request #20188: [BUGFIX]try avoid the error in operator/tensor/amp_cast.h

Posted by GitBox <gi...@apache.org>.
Neutron3529 commented on a change in pull request #20188:
URL: https://github.com/apache/incubator-mxnet/pull/20188#discussion_r616061336



##########
File path: 3rdparty/mshadow/mshadow/base.h
##########
@@ -1364,7 +1364,8 @@ struct minimum {
   default:                                          \
     LOG(FATAL) << "Unknown type enum " << type;     \
   }
-
+// amp_cast.h is using this MSHADOW_TYPE_SWITCH_WITH_BOOL in order to
+// avoid 'Unsupport enum type 12' error.

Review comment:
       Actually I put this comment as a TODO...
   It is more harder than I thought to make bf16 work.
   I had tried my best, but I have no idea about convolution ops.
   This is a very very dirty fix and should be modified by another PR.
   
   this PR only enable bf16 on dense layers
   There are lots of works todo in the future.
   
   Is it OK to mark a TODO on this comment?
   Or simply delete this comment?




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-mxnet] Neutron3529 commented on pull request #20188: [BUGFIX]try avoid the error in operator/tensor/amp_cast.h

Posted by GitBox <gi...@apache.org>.
Neutron3529 commented on pull request #20188:
URL: https://github.com/apache/incubator-mxnet/pull/20188#issuecomment-822663487


    @mxnet-bot run ci  [unix-gpu]


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-mxnet] mxnet-bot commented on pull request #20188: [BUGFIX]try avoid the error in operator/tensor/amp_cast.h

Posted by GitBox <gi...@apache.org>.
mxnet-bot commented on pull request #20188:
URL: https://github.com/apache/incubator-mxnet/pull/20188#issuecomment-829001528


   Jenkins CI successfully triggered : [centos-cpu, unix-gpu]


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-mxnet] Neutron3529 commented on pull request #20188: [BUGFIX]try avoid the error in operator/tensor/amp_cast.h

Posted by GitBox <gi...@apache.org>.
Neutron3529 commented on pull request #20188:
URL: https://github.com/apache/incubator-mxnet/pull/20188#issuecomment-829001464


   @mxnet-bot run ci [unix-gpu, centos-cpu]


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-mxnet] Neutron3529 commented on pull request #20188: [BUGFIX]try avoid the error in operator/tensor/amp_cast.h

Posted by GitBox <gi...@apache.org>.
Neutron3529 commented on pull request #20188:
URL: https://github.com/apache/incubator-mxnet/pull/20188#issuecomment-830820166


   > @Neutron3529 thank you!
   
   You're welcome.
   
   Since I am in China, it is not very convenience to visit github.
   You may open a new issue about the amp support with `bfloat16`.
   
   This commit do not work at least with convolution layers.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-mxnet] szha commented on a change in pull request #20188: [BUGFIX]try avoid the error in operator/tensor/amp_cast.h

Posted by GitBox <gi...@apache.org>.
szha commented on a change in pull request #20188:
URL: https://github.com/apache/incubator-mxnet/pull/20188#discussion_r615923064



##########
File path: 3rdparty/mshadow/mshadow/base.h
##########
@@ -1364,7 +1364,8 @@ struct minimum {
   default:                                          \
     LOG(FATAL) << "Unknown type enum " << type;     \
   }
-
+// amp_cast.h is using this MSHADOW_TYPE_SWITCH_WITH_BOOL in order to
+// avoid 'Unsupport enum type 12' error.

Review comment:
       no need to have this comment here as we don't leave comments on every usage of the macro




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-mxnet] mxnet-bot commented on pull request #20188: try avoid the error in operator/tensor/amp_cast.h

Posted by GitBox <gi...@apache.org>.
mxnet-bot commented on pull request #20188:
URL: https://github.com/apache/incubator-mxnet/pull/20188#issuecomment-822183254


   Hey @Neutron3529 , Thanks for submitting the PR 
   All tests are already queued to run once. If tests fail, you can trigger one or more tests again with the following commands: 
   - To trigger all jobs: @mxnet-bot run ci [all] 
   - To trigger specific jobs: @mxnet-bot run ci [job1, job2] 
   *** 
   **CI supported jobs**: [centos-gpu, unix-cpu, unix-gpu, clang, website, windows-cpu, edge, sanity, centos-cpu, windows-gpu, miscellaneous]
   *** 
   _Note_: 
    Only following 3 categories can trigger CI :PR Author, MXNet Committer, Jenkins Admin. 
   All CI tests must pass before the PR can be merged. 
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-mxnet] szha commented on a change in pull request #20188: [BUGFIX]try avoid the error in operator/tensor/amp_cast.h

Posted by GitBox <gi...@apache.org>.
szha commented on a change in pull request #20188:
URL: https://github.com/apache/incubator-mxnet/pull/20188#discussion_r618041061



##########
File path: 3rdparty/mshadow/mshadow/base.h
##########
@@ -1364,7 +1364,8 @@ struct minimum {
   default:                                          \
     LOG(FATAL) << "Unknown type enum " << type;     \
   }
-
+// amp_cast.h is using this MSHADOW_TYPE_SWITCH_WITH_BOOL in order to
+// avoid 'Unsupport enum type 12' error.

Review comment:
       I suggest to remove it and then track any todo as a separate issue.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-mxnet] szha commented on pull request #20188: [BUGFIX]try avoid the error in operator/tensor/amp_cast.h

Posted by GitBox <gi...@apache.org>.
szha commented on pull request #20188:
URL: https://github.com/apache/incubator-mxnet/pull/20188#issuecomment-830137060


   @Neutron3529 thank you!


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-mxnet] szha merged pull request #20188: [BUGFIX]try avoid the error in operator/tensor/amp_cast.h

Posted by GitBox <gi...@apache.org>.
szha merged pull request #20188:
URL: https://github.com/apache/incubator-mxnet/pull/20188


   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org