mirror of
https://github.com/saymrwulf/onnxruntime.git
synced 2026-07-30 20:18:08 +00:00
Remove use of RTTI in CUDA provider (#4444)
This commit is contained in:
parent
fdb4a3a2e8
commit
e62686c36e
10 changed files with 13 additions and 13 deletions
|
|
@ -38,7 +38,7 @@ class BatchNorm final : public OpKernel {
|
|||
ORT_ENFORCE(st.IsOK(), st.ErrorMessage());
|
||||
|
||||
provider_ = (const_cast<ACLExecutionProvider*>(
|
||||
dynamic_cast<const ACLExecutionProvider*>(info.GetExecutionProvider())));
|
||||
static_cast<const ACLExecutionProvider*>(info.GetExecutionProvider())));
|
||||
}
|
||||
|
||||
~BatchNorm() {
|
||||
|
|
|
|||
|
|
@ -40,7 +40,7 @@ class Conv : public onnxruntime::Conv<T> {
|
|||
public:
|
||||
explicit Conv(const OpKernelInfo& info) : onnxruntime::Conv<T>(info), conv_attrs_(info) {
|
||||
provider_ = (const_cast<ACLExecutionProvider*>(
|
||||
dynamic_cast<const ACLExecutionProvider*>(info.GetExecutionProvider())));
|
||||
static_cast<const ACLExecutionProvider*>(info.GetExecutionProvider())));
|
||||
}
|
||||
|
||||
~Conv() {
|
||||
|
|
|
|||
|
|
@ -35,7 +35,7 @@ class Pool final : public onnxruntime::Pool<T, PoolType> {
|
|||
public:
|
||||
explicit Pool(const OpKernelInfo& info) : onnxruntime::Pool<T, PoolType>(info) {
|
||||
provider_ = (const_cast<ACLExecutionProvider*>(
|
||||
dynamic_cast<const ACLExecutionProvider*>(info.GetExecutionProvider())));
|
||||
static_cast<const ACLExecutionProvider*>(info.GetExecutionProvider())));
|
||||
}
|
||||
|
||||
~Pool() {
|
||||
|
|
@ -54,7 +54,7 @@ class MaxPoolV8 final : public onnxruntime::MaxPoolV8 {
|
|||
public:
|
||||
explicit MaxPoolV8(const OpKernelInfo& info) : onnxruntime::MaxPoolV8(info) {
|
||||
provider_ = (const_cast<ACLExecutionProvider*>(
|
||||
dynamic_cast<const ACLExecutionProvider*>(info.GetExecutionProvider())));
|
||||
static_cast<const ACLExecutionProvider*>(info.GetExecutionProvider())));
|
||||
}
|
||||
|
||||
~MaxPoolV8() {
|
||||
|
|
@ -68,4 +68,4 @@ class MaxPoolV8 final : public onnxruntime::MaxPoolV8 {
|
|||
ACLExecutionProvider* provider_;
|
||||
};
|
||||
} // namespace acl
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@ class Concat : public onnxruntime::Concat {
|
|||
explicit Concat(const OpKernelInfo& info) : onnxruntime::Concat(info) {
|
||||
|
||||
provider_ = (const_cast<ACLExecutionProvider*>(
|
||||
dynamic_cast<const ACLExecutionProvider*>(info.GetExecutionProvider())));
|
||||
static_cast<const ACLExecutionProvider*>(info.GetExecutionProvider())));
|
||||
}
|
||||
|
||||
~Concat() {}
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ class Relu : public OpKernel {
|
|||
public:
|
||||
explicit Relu(const OpKernelInfo& info) : OpKernel(info) {
|
||||
provider_ = (const_cast<ArmNNExecutionProvider*>(
|
||||
dynamic_cast<const ArmNNExecutionProvider*>(info.GetExecutionProvider())));
|
||||
static_cast<const ArmNNExecutionProvider*>(info.GetExecutionProvider())));
|
||||
}
|
||||
|
||||
~Relu() {
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@ class Conv : public onnxruntime::Conv<T> {
|
|||
public:
|
||||
explicit Conv(const OpKernelInfo& info) : onnxruntime::Conv<T>(info), conv_attrs_(info) {
|
||||
provider_ = (const_cast<ArmNNExecutionProvider*>(
|
||||
dynamic_cast<const ArmNNExecutionProvider*>(info.GetExecutionProvider())));
|
||||
static_cast<const ArmNNExecutionProvider*>(info.GetExecutionProvider())));
|
||||
}
|
||||
|
||||
~Conv() {
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@ class Pool final : public onnxruntime::Pool<T, PoolType> {
|
|||
public:
|
||||
explicit Pool(const OpKernelInfo& info) : onnxruntime::Pool<T, PoolType>(info) {
|
||||
provider_ = (const_cast<ArmNNExecutionProvider*>(
|
||||
dynamic_cast<const ArmNNExecutionProvider*>(info.GetExecutionProvider())));
|
||||
static_cast<const ArmNNExecutionProvider*>(info.GetExecutionProvider())));
|
||||
}
|
||||
|
||||
~Pool() {
|
||||
|
|
@ -49,7 +49,7 @@ class MaxPoolV8 final : public onnxruntime::MaxPoolV8 {
|
|||
public:
|
||||
explicit MaxPoolV8(const OpKernelInfo& info) : onnxruntime::MaxPoolV8(info) {
|
||||
provider_ = (const_cast<ArmNNExecutionProvider*>(
|
||||
dynamic_cast<const ArmNNExecutionProvider*>(info.GetExecutionProvider())));
|
||||
static_cast<const ArmNNExecutionProvider*>(info.GetExecutionProvider())));
|
||||
}
|
||||
|
||||
~MaxPoolV8() {
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ namespace onnxruntime {
|
|||
static const GPUDataTransfer* GetGPUDataTransfer(const SessionState* session_state) {
|
||||
OrtDevice gpu_device(OrtDevice::GPU, OrtDevice::MemType::DEFAULT, 0);
|
||||
OrtDevice cpu_device;
|
||||
return dynamic_cast<const GPUDataTransfer*>(session_state->GetDataTransferMgr().GetDataTransfer(gpu_device, cpu_device));
|
||||
return static_cast<const GPUDataTransfer*>(session_state->GetDataTransferMgr().GetDataTransfer(gpu_device, cpu_device));
|
||||
}
|
||||
|
||||
void CUDAAllocator::CheckDevice(bool throw_when_fail) const {
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@ class Einsum final : public onnxruntime::Einsum {
|
|||
// We need to cast away the const as PerThreadCublasHandle() is currently a non-const method
|
||||
// TODO: Clean up the CUDAExecutionProvider interface to avoid this
|
||||
cuda_ep_ = const_cast<CUDAExecutionProvider*>(
|
||||
dynamic_cast<const CUDAExecutionProvider*>(info.GetExecutionProvider()));
|
||||
static_cast<const CUDAExecutionProvider*>(info.GetExecutionProvider()));
|
||||
}
|
||||
|
||||
Status Compute(OpKernelContext* context) const override;
|
||||
|
|
|
|||
|
|
@ -51,7 +51,7 @@ class ReduceKernel : public CudaKernel, public ReduceKernelBase<allow_multi_axes
|
|||
fast_reduction_(false) {
|
||||
// We need to cast away the const as PerThreadCudnnHandle() is currently a non-const method
|
||||
// TODO: Clean up the CUDAExecutionProvider interface to avoid this
|
||||
cuda_ep_ = const_cast<CUDAExecutionProvider*>(dynamic_cast<const CUDAExecutionProvider*>(info.GetExecutionProvider()));
|
||||
cuda_ep_ = const_cast<CUDAExecutionProvider*>(static_cast<const CUDAExecutionProvider*>(info.GetExecutionProvider()));
|
||||
}
|
||||
|
||||
// Only Max Min need to set ReduceTensorIndices CUDNN_REDUCE_TENSOR_FLATTENED_INDICES as per cudnn library manual
|
||||
|
|
|
|||
Loading…
Reference in a new issue