elementwise op#238
Conversation
rocking5566
commented
May 17, 2022
- kernel of 1D binary_elementwise.
- Device op of 1D and 2D of binary_elementwise
- elementwise_add and broadcast_add example
| #pragma once | ||
| #include <vector> | ||
|
|
||
| namespace ck { |
There was a problem hiding this comment.
this function doesn't need to stay in ck namespce
| a_m_device_buf.GetDeviceBuffer(), | ||
| b_m_device_buf.GetDeviceBuffer(), | ||
| c_m_device_buf.GetDeviceBuffer(), | ||
| ck::convert_vector_element_type<std::size_t, ck::index_t>(nchw), |
There was a problem hiding this comment.
does assign works? If so, convert_vector_element_type would not be needed
https://en.cppreference.com/w/cpp/container/vector/assign
There was a problem hiding this comment.
Good suggestion.
You make it found a better way.
I will use constructor instead.
std::vectorck::index_t{nchw.begin(), nchw.end()}
|
|
||
| Tensor<ABDataType> a_m(nchw); | ||
| Tensor<ABDataType> b_m(nchw); | ||
| Tensor<ABDataType> c_m(nchw); |
|
|
||
| struct Invoker : public BaseInvoker | ||
| { | ||
| Invoker(index_t blockSize) : BaseInvoker(), blockSize_(blockSize) {} |
There was a problem hiding this comment.
blockSize should be inside Argument, not Invoker.
By design, DeviceOp and Argument should contain all the information necessary to launch a kernel, otherwise IsSupportedArgument(Argument*) would not know for sure if DeviceOp support a configuration or not
I think MakeArgument() should not have blockSize as argument, because MakeArgument() should not reflect kernel implementation detail. You can put blockSize as a member of this DeviceOp, and give it a default value (1024, for example), user can choose to change the value of blockSize then self, if really needed.