From 52e2bdf5417ac52ce61fbef4ae6e12fe3e1ea84d Mon Sep 17 00:00:00 2001 From: Tianlei Wu Date: Wed, 21 Jun 2023 13:31:43 -0700 Subject: [PATCH] Add license header to CUDA related files (#16437) Add license header for files under core/providers/cuda or contrib_ops/cuda/ --- .../cuda/bert/add_bias_transpose.cu | 1 + .../cuda/bert/embed_layer_norm_impl.h | 1 + .../cuda/bert/transformer_common.cc | 1 + .../cuda/collective/nccl_kernels.cc | 1 + .../cuda/math/binary_elementwise_ops_impl.h | 3 +++ .../quantization/qordered_ops/qordered_qdq.cc | 3 ++- .../cuda/cu_inc/variadic_elementwise_impl.cuh | 3 +++ .../providers/cuda/cuda_provider_interface.cc | 3 +++ .../core/providers/cuda/cuda_stream_handle.cc | 3 ++- .../core/providers/cuda/cuda_stream_handle.h | 3 ++- .../core/providers/cuda/cupti_manager.cc | 3 +++ .../core/providers/cuda/cupti_manager.h | 3 +++ .../cuda/generator/constant_of_shape.cc | 1 + .../core/providers/cuda/tensor/resize_impl.cu | 23 +++++++++++-------- .../providers/cuda/tensor/scatter_elements.h | 1 + 15 files changed, 40 insertions(+), 13 deletions(-) diff --git a/onnxruntime/contrib_ops/cuda/bert/add_bias_transpose.cu b/onnxruntime/contrib_ops/cuda/bert/add_bias_transpose.cu index e52cb0f692..5727044b94 100644 --- a/onnxruntime/contrib_ops/cuda/bert/add_bias_transpose.cu +++ b/onnxruntime/contrib_ops/cuda/bert/add_bias_transpose.cu @@ -1,5 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. + #include "core/providers/cuda/cuda_common.h" #include "core/providers/cuda/cu_inc/common.cuh" #include "contrib_ops/cuda/bert/add_bias_transpose.h" diff --git a/onnxruntime/contrib_ops/cuda/bert/embed_layer_norm_impl.h b/onnxruntime/contrib_ops/cuda/bert/embed_layer_norm_impl.h index 605f8b8dfd..aaf1d891da 100644 --- a/onnxruntime/contrib_ops/cuda/bert/embed_layer_norm_impl.h +++ b/onnxruntime/contrib_ops/cuda/bert/embed_layer_norm_impl.h @@ -1,5 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. + #pragma once #include "core/common/common.h" diff --git a/onnxruntime/contrib_ops/cuda/bert/transformer_common.cc b/onnxruntime/contrib_ops/cuda/bert/transformer_common.cc index 0c22bc5a29..675d12eb23 100644 --- a/onnxruntime/contrib_ops/cuda/bert/transformer_common.cc +++ b/onnxruntime/contrib_ops/cuda/bert/transformer_common.cc @@ -1,5 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. + #include #include "core/providers/shared_library/provider_api.h" // Include this otherwise Windows build complains Env::Default() missing #include "core/platform/env_var_utils.h" diff --git a/onnxruntime/contrib_ops/cuda/collective/nccl_kernels.cc b/onnxruntime/contrib_ops/cuda/collective/nccl_kernels.cc index a89b861c8e..1393c7b945 100644 --- a/onnxruntime/contrib_ops/cuda/collective/nccl_kernels.cc +++ b/onnxruntime/contrib_ops/cuda/collective/nccl_kernels.cc @@ -1,5 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. + #include "nccl_kernels.h" #include "mpi_include.h" #include "core/providers/cuda/tensor/transpose.h" diff --git a/onnxruntime/contrib_ops/cuda/math/binary_elementwise_ops_impl.h b/onnxruntime/contrib_ops/cuda/math/binary_elementwise_ops_impl.h index dc0382fcb3..c15639b729 100644 --- a/onnxruntime/contrib_ops/cuda/math/binary_elementwise_ops_impl.h +++ b/onnxruntime/contrib_ops/cuda/math/binary_elementwise_ops_impl.h @@ -1,3 +1,6 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + #include #include "core/providers/cuda/shared_inc/cuda_utils.h" diff --git a/onnxruntime/contrib_ops/cuda/quantization/qordered_ops/qordered_qdq.cc b/onnxruntime/contrib_ops/cuda/quantization/qordered_ops/qordered_qdq.cc index f567ed7a3e..b4ec1a69a4 100644 --- a/onnxruntime/contrib_ops/cuda/quantization/qordered_ops/qordered_qdq.cc +++ b/onnxruntime/contrib_ops/cuda/quantization/qordered_ops/qordered_qdq.cc @@ -1,4 +1,5 @@ - +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. #include "core/framework/tensor_shape.h" #include "contrib_ops/cuda/quantization/qordered_ops/qordered_qdq.h" diff --git a/onnxruntime/core/providers/cuda/cu_inc/variadic_elementwise_impl.cuh b/onnxruntime/core/providers/cuda/cu_inc/variadic_elementwise_impl.cuh index e3a3c6a969..2df1a3aed1 100644 --- a/onnxruntime/core/providers/cuda/cu_inc/variadic_elementwise_impl.cuh +++ b/onnxruntime/core/providers/cuda/cu_inc/variadic_elementwise_impl.cuh @@ -1,3 +1,6 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + #pragma once #include "core/providers/cuda/cu_inc/common.cuh" diff --git a/onnxruntime/core/providers/cuda/cuda_provider_interface.cc b/onnxruntime/core/providers/cuda/cuda_provider_interface.cc index adb4c525cb..9632ecba3d 100644 --- a/onnxruntime/core/providers/cuda/cuda_provider_interface.cc +++ b/onnxruntime/core/providers/cuda/cuda_provider_interface.cc @@ -1,3 +1,6 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + #include "core/session/onnxruntime_c_api.h" namespace onnxruntime { diff --git a/onnxruntime/core/providers/cuda/cuda_stream_handle.cc b/onnxruntime/core/providers/cuda/cuda_stream_handle.cc index 7f6b858038..b7d2d2100e 100644 --- a/onnxruntime/core/providers/cuda/cuda_stream_handle.cc +++ b/onnxruntime/core/providers/cuda/cuda_stream_handle.cc @@ -1,5 +1,6 @@ -//// Copyright (c) Microsoft Corporation. All rights reserved. +// Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. + #include "core/providers/cuda/cuda_stream_handle.h" #include "core/providers/cuda/cuda_common.h" #include "core/common/spin_pause.h" diff --git a/onnxruntime/core/providers/cuda/cuda_stream_handle.h b/onnxruntime/core/providers/cuda/cuda_stream_handle.h index 3cf76cefe4..443fe7687d 100644 --- a/onnxruntime/core/providers/cuda/cuda_stream_handle.h +++ b/onnxruntime/core/providers/cuda/cuda_stream_handle.h @@ -1,5 +1,6 @@ -//// Copyright (c) Microsoft Corporation. All rights reserved. +// Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. + #pragma once #include "core/providers/cuda/cuda_pch.h" #include "core/providers/cuda/shared_inc/cuda_utils.h" diff --git a/onnxruntime/core/providers/cuda/cupti_manager.cc b/onnxruntime/core/providers/cuda/cupti_manager.cc index ae1051d216..11eac13521 100644 --- a/onnxruntime/core/providers/cuda/cupti_manager.cc +++ b/onnxruntime/core/providers/cuda/cupti_manager.cc @@ -1,3 +1,6 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + #include "cupti_manager.h" #include diff --git a/onnxruntime/core/providers/cuda/cupti_manager.h b/onnxruntime/core/providers/cuda/cupti_manager.h index 629d99c1f5..cca78dcec5 100644 --- a/onnxruntime/core/providers/cuda/cupti_manager.h +++ b/onnxruntime/core/providers/cuda/cupti_manager.h @@ -1,3 +1,6 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + #pragma once #if defined(USE_CUDA) && defined(ENABLE_CUDA_PROFILING) diff --git a/onnxruntime/core/providers/cuda/generator/constant_of_shape.cc b/onnxruntime/core/providers/cuda/generator/constant_of_shape.cc index a31e533b5f..1a7f2422a8 100644 --- a/onnxruntime/core/providers/cuda/generator/constant_of_shape.cc +++ b/onnxruntime/core/providers/cuda/generator/constant_of_shape.cc @@ -1,5 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. + #include "constant_of_shape.h" using namespace ::onnxruntime::common; diff --git a/onnxruntime/core/providers/cuda/tensor/resize_impl.cu b/onnxruntime/core/providers/cuda/tensor/resize_impl.cu index 5f6e52ff5a..1a94c7705e 100644 --- a/onnxruntime/core/providers/cuda/tensor/resize_impl.cu +++ b/onnxruntime/core/providers/cuda/tensor/resize_impl.cu @@ -1,3 +1,6 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + #include "core/providers/cuda/cu_inc/common.cuh" #include "core/providers/cuda/tensor/resize_impl.h" @@ -156,7 +159,7 @@ __global__ void _ResizeNearestMappingKernel2D( extrapolation_enabled && (orig_coord < 0.f || orig_coord > static_cast(input_height - 1))); dim = calc_nearest_pixel(orig_coord, scales_height < 1); if (dim >= input_height) dim = input_height - 1; - if (dim < 0) dim = 0; + if (dim < 0) dim = 0; } dims_mapping[id].origin_ = dim; @@ -173,7 +176,7 @@ __global__ void _ResizeNearestMappingKernel2D( extrapolation_enabled && (orig_coord < 0.f || orig_coord > static_cast(input_width - 1))); dim = calc_nearest_pixel(orig_coord, scales_width < 1); if (dim >= input_width) dim = input_width - 1; - if (dim < 0) dim = 0; + if (dim < 0) dim = 0; } dims_mapping[id].origin_ = dim; @@ -212,7 +215,7 @@ __global__ void _ResizeNearestMappingKernel( dims_mapping[id].extrapolate_ = static_cast(extrapolation_enabled && (orig_coord < 0.f || orig_coord > static_cast(input_shape[axis] - 1))); dim = calc_nearest_pixel(orig_coord, scales[axis] < 1); if (dim >= input_shape[axis]) dim = input_shape[axis] - 1; - if (dim < 0) dim = 0; + if (dim < 0) dim = 0; } dims_mapping[id].origin_ = dim; @@ -378,9 +381,9 @@ __global__ void _ResizeTrilinearCoordinateMapping( dims_mapping[id].origin_ = z_int; dims_mapping[id].weight_ = (z_int >= input_depth - 1) ? 0.5f : input_z - z_int; } else if (id >= output_depth && id < (output_depth + output_height)) { // y = id - output_depth - float input_y = scale_height == 1 ? static_cast(id - output_depth) : - transform_coordinate(static_cast(id - output_depth), scale_height, - static_cast(output_height), static_cast(input_height), + float input_y = scale_height == 1 ? static_cast(id - output_depth) : + transform_coordinate(static_cast(id - output_depth), scale_height, + static_cast(output_height), static_cast(input_height), roi_height_start, roi_height_end); dims_mapping[id].extrapolate_ = (int)(extrapolation_enabled && (input_y < 0 || input_y > static_cast(input_height - 1))); @@ -416,12 +419,12 @@ __global__ void _ResizeTrilinearKernel( div_output_image.divmod(id, bxc, output_image_index); CUDA_LONG input_index = bxc * input_depth * input_height * input_width; int output_z, output_y, output_x, temp; - + div_output_height.divmod(output_image_index, output_z, temp); div_output_width.divmod(temp, output_y, output_x); - if (dims_mapping[output_z].extrapolate_ || - dims_mapping[output_y + output_depth].extrapolate_ || + if (dims_mapping[output_z].extrapolate_ || + dims_mapping[output_y + output_depth].extrapolate_ || dims_mapping[output_x + output_depth + output_height].extrapolate_) { output_data[id] = extrapolation_value; return; @@ -435,7 +438,7 @@ __global__ void _ResizeTrilinearKernel( float x_offset_0 = dims_mapping[output_x + output_depth + output_height].weight_; int x_int = dims_mapping[output_x + output_depth + output_height].origin_; - + input_index += z_int * input_height * input_width + y_int * input_width + x_int; T x000 = input_data[input_index]; diff --git a/onnxruntime/core/providers/cuda/tensor/scatter_elements.h b/onnxruntime/core/providers/cuda/tensor/scatter_elements.h index bbf33b84a1..3e9e0ce041 100755 --- a/onnxruntime/core/providers/cuda/tensor/scatter_elements.h +++ b/onnxruntime/core/providers/cuda/tensor/scatter_elements.h @@ -1,5 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. + #pragma once #include "core/providers/shared_library/provider_api.h"