/*******************************************************************************
* Copyright 2025 Intel Corporation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
*     http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*******************************************************************************/

#include "gpu/intel/compute/kernel_ctx.hpp"
#include "gpu/intel/primitive_conf.hpp"

namespace dnnl {
namespace impl {
namespace gpu {
namespace intel {
namespace compute {

void kernel_ctx_t::register_buffer_size(const memory_desc_wrapper &mdw) {
    register_buffer_size(mdw.nelems(true), mdw.size(0, true, true));
}

void kernel_ctx_t::register_buffer_size(const memory_desc_info_t &mdi) {
    register_buffer_size(
            (mdi.size / types::data_type_size(mdi.data_type)) + mdi.offset0,
            mdi.size + (mdi.offset0 * types::data_type_size(mdi.data_type)));
}

} // namespace compute
} // namespace intel
} // namespace gpu
} // namespace impl
} // namespace dnnl
