Skip to content

Commit

Permalink
Merge pull request #80 from GPUOpen-LibrariesAndSDKs/release/hip5.7_c…
Browse files Browse the repository at this point in the history
…uda12.2

Release/hip5.7 cuda12.2
  • Loading branch information
RichardGe authored Mar 29, 2024
2 parents 65de35c + 17c5b98 commit 0226611
Show file tree
Hide file tree
Showing 125 changed files with 33,088 additions and 6,215 deletions.
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,7 @@ dist/**
.DS_Store
.vs/
build/

result.xml
UnitTest/bitcodes/*.fatbin
Test/SimpleD3D12/cache/**
48 changes: 48 additions & 0 deletions Orochi/GpuMemory.h
Original file line number Diff line number Diff line change
@@ -1,3 +1,25 @@
//
// Copyright (c) 2021-2024 Advanced Micro Devices, Inc. All rights reserved.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
//

#pragma once

#include <Orochi/OrochiUtils.h>
Expand Down Expand Up @@ -91,9 +113,35 @@ class GpuMemory final
*this = std::move( tmp );
}

/// @brief Asynchronous version of 'resize' using a given Orochi stream.
/// @param new_size The new memory size after the function is called.
/// @param copy If true, the function will copy the data to the newly created memory space as well.
/// @param stream The Orochi stream used for the underlying operations.
void resizeAsync( const size_t new_size, const bool copy = false, oroStream stream = 0 ) noexcept
{
if( new_size <= m_capacity )
{
m_size = new_size;
return;
}

GpuMemory tmp( new_size );

if( copy )
{
OrochiUtils::copyDtoDAsync( tmp.m_data, m_data, m_size, stream );
}

*this = std::move( tmp );
}

/// @brief Reset the memory space so that all bits inside are cleared to zero.
void reset() noexcept { OrochiUtils::memset( m_data, 0, m_size * sizeof( T ) ); }

/// @brief Asynchronous version of 'reset' using a given Orochi stream.
/// @param stream The Orochi stream used for the underlying operations.
void resetAsync( oroStream stream = 0 ) noexcept { OrochiUtils::memsetAsync( m_data, 0, m_size * sizeof( T ), stream ); }

/// @brief Copy the data from device memory to host.
/// @param host_ptr The host pointer.
/// @param host_data_size The size of the host memory which represents the number of elements.
Expand Down
3,730 changes: 3,320 additions & 410 deletions Orochi/Orochi.cpp

Large diffs are not rendered by default.

1,902 changes: 1,199 additions & 703 deletions Orochi/Orochi.h

Large diffs are not rendered by default.

Loading

0 comments on commit 0226611

Please sign in to comment.