Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merge changes for tensor mean and stddev PR #273

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 25 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,30 @@

Full documentation for RPP is available at (https://rocm.docs.amd.com/projects/rpp/en/latest/).

### RPP 1.5.0 (unreleased)
### RPP 1.8.0 (unreleased)

### Changes

* Prerequisites - ROCm install requires only --usecase=rocm
* Use pre-allocated common scratchBufferHip everywhere in Tensor code for scratch HIP memory
* Use CHECK_RETURN_STATUS everywhere to adhere to C++17 for hip
* RPP Tensor Audio support on HOST for Spectrogram
* RPP Tensor Audio support on HOST/HIP for Slice, by modifying voxel slice kernels to now accept anchor and shape params for a more generic version
* RPP Tensor Audio support on HOST for Mel Filter Bank
* RPP Tensor Normalize ND support on HOST and HIP

### Tested configurations

* Linux distribution
* Ubuntu - `20.04` / `22.04`
* CentOS - `7`
* RHEL - `8`/`9`
* ROCm: rocm-core - `6.1.0.60100`
* Clang - Version `5.0.1`
* CMake - Version `3.22.3`
* IEEE 754-based half-precision floating-point library - Version `1.12.0`

### RPP 1.5.0

### Changes

Expand Down Expand Up @@ -376,4 +399,4 @@ Full documentation for RPP is available at (https://rocm.docs.amd.com/projects/r

### Known issues

* `CPU` backend is not enabled
* `CPU` backend is not enabled
4 changes: 1 addition & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -308,6 +308,7 @@ message("-- ${White}${PROJECT_NAME} -- Link Libraries: ${LINK_LIBRARY_LIST}${Col
target_link_libraries(${PROJECT_NAME} ${LINK_LIBRARY_LIST})
set_target_properties(${PROJECT_NAME} PROPERTIES POSITION_INDEPENDENT_CODE ON)
set_target_properties(${PROJECT_NAME} PROPERTIES LINKER_LANGUAGE CXX)
target_link_libraries(${PROJECT_NAME} ${PROJECT_SOURCE_DIR}/libs/third_party/ffts/libffts.a)
set_target_properties(${PROJECT_NAME} PROPERTIES VERSION ${PROJECT_VERSION} SOVERSION ${PROJECT_VERSION_MAJOR})

target_include_directories(${PROJECT_NAME}
Expand Down Expand Up @@ -429,15 +430,12 @@ set(CPACK_RPM_COMPONENT_INSTALL ON)
set(CPACK_RPM_RUNTIME_PACKAGE_NAME "${PROJECT_NAME}")
set(CPACK_RPM_RUNTIME_PACKAGE_REQUIRES "rocm-core, ${RPP_RPM_PACKAGE_LIST}")
set(CPACK_RPM_RUNTIME_PACKAGE_PROVIDES "${PROJECT_NAME}")
set(CPACK_RPM_RUNTIME_PACKAGE_OBSOLETES "${PROJECT_NAME}")
set(CPACK_RPM_DEV_PACKAGE_NAME "${PROJECT_NAME}-devel")
set(CPACK_RPM_DEV_PACKAGE_REQUIRES "rocm-core, ${PROJECT_NAME}, ${RPP_RPM_DEV_PACKAGE_LIST}")
set(CPACK_RPM_DEV_PACKAGE_PROVIDES "${PROJECT_NAME}-devel")
set(CPACK_RPM_DEV_PACKAGE_OBSOLETES "${PROJECT_NAME}-devel")
set(CPACK_RPM_TEST_PACKAGE_NAME "${PROJECT_NAME}-test")
set(CPACK_RPM_TEST_PACKAGE_REQUIRES "rocm-core, ${PROJECT_NAME}-devel")
set(CPACK_RPM_TEST_PACKAGE_PROVIDES "${PROJECT_NAME}-test")
set(CPACK_RPM_TEST_PACKAGE_OBSOLETES "${PROJECT_NAME}-test")
set(CPACK_RPM_PACKAGE_LICENSE "MIT" )
# RPM package specific variable for ASAN
set(CPACK_RPM_ASAN_PACKAGE_NAME "${PROJECT_NAME}-asan" )
Expand Down
16 changes: 8 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,14 @@ Input<br>(nifti1 .nii medical image) | fused_multiply_add_scalar<br>(brightened
## Prerequisites

* Linux
* **Ubuntu** - `20.04` / `22.04`
* **CentOS** - `7`
* **RedHat** - `8` / `9`
* **SLES** - `15-SP4`
* Ubuntu - `20.04` / `22.04`
* CentOS - `7`
* RedHat - `8` / `9`
* SLES - `15-SP4`

* [ROCm supported hardware](https://rocm.docs.amd.com/projects/install-on-linux/en/latest/reference/system-requirements.html)

* Install ROCm with [amdgpu-install](https://rocm.docs.amd.com/projects/install-on-linux/en/latest/how-to/amdgpu-install.html) with `--usecase=graphics,rocm --no-32`
* Install ROCm with [amdgpu-install](https://rocm.docs.amd.com/projects/install-on-linux/en/latest/how-to/amdgpu-install.html) with `--usecase=rocm`

* Clang Version `5.0.1` and above

Expand Down Expand Up @@ -74,15 +74,15 @@ Input<br>(nifti1 .nii medical image) | fused_multiply_add_scalar<br>(brightened
sudo apt-get install half
```

> [!NOTE]
> You must use the appropriate package manager for your operating system.

* Compiler with support for C++ Version `17` and above

* OpenMP

* Threads

> [!NOTE]
> You must use the appropriate package manager for your operating system.

## Build and install instructions

### Package install
Expand Down
2 changes: 1 addition & 1 deletion docker/rpp-on-ubuntu20.dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ RUN DEBIAN_FRONTEND=noninteractive apt-get -y install initramfs-tools libnuma-de
wget ${ROCM_INSTALLER_REPO} && \
sudo apt-get install -y ./${ROCM_INSTALLER_PACKAGE} && \
sudo apt-get update -y && \
sudo amdgpu-install -y --usecase=graphics,rocm
sudo amdgpu-install -y --usecase=rocm
# install rpp dependencies - half.hpp
RUN wget https://sourceforge.net/projects/half/files/half/1.12.0/half-1.12.0.zip && \
unzip half-1.12.0.zip -d half-files && mkdir -p /usr/local/include/half && cp half-files/include/half.hpp /usr/local/include/half
Expand Down
2 changes: 1 addition & 1 deletion docker/rpp-on-ubuntu22.dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ RUN DEBIAN_FRONTEND=noninteractive apt-get -y install initramfs-tools libnuma-de
wget ${ROCM_INSTALLER_REPO} && \
sudo apt-get install -y ./${ROCM_INSTALLER_PACKAGE} && \
sudo apt-get update -y && \
sudo amdgpu-install -y --usecase=graphics,rocm
sudo amdgpu-install -y --usecase=rocm
# install rpp dependencies - half.hpp
RUN wget https://sourceforge.net/projects/half/files/half/1.12.0/half-1.12.0.zip && \
unzip half-1.12.0.zip -d half-files && mkdir -p /usr/local/include/half && cp half-files/include/half.hpp /usr/local/include/half
Expand Down
2 changes: 1 addition & 1 deletion docs/install/install.rst
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ Prerequisites

* `ROCm supported hardware <https://rocm.docs.amd.com/projects/install-on-linux/en/latest/reference/system-requirements.html>`_

* Install ROCm with `amdgpu-install <https://rocm.docs.amd.com/projects/install-on-linux/en/latest/how-to/amdgpu-install.html>`_ with ``--usecase=graphics,rocm --no-32``
* Install ROCm with `amdgpu-install <https://rocm.docs.amd.com/projects/install-on-linux/en/latest/how-to/amdgpu-install.html>`_ with ``--usecase=rocm``

* Clang Version `5.0.1` and above

Expand Down
23 changes: 18 additions & 5 deletions include/rppdefs.h
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ typedef enum
/*! \brief Out of bound source ROI \ingroup group_rppdefs */
RPP_ERROR_OUT_OF_BOUND_SRC_ROI = -17,
/*! \brief src and dst layout mismatch \ingroup group_rppdefs */
RPP_ERROR_SRC_DST_LAYOUT_MISMATCH = -18,
RPP_ERROR_LAYOUT_MISMATCH = -18,
/*! \brief Number of channels is invalid. (Needs to adhere to function specification.) \ingroup group_rppdefs */
RPP_ERROR_INVALID_CHANNELS = -19
} RppStatus;
Expand Down Expand Up @@ -369,10 +369,13 @@ typedef enum
*/
typedef enum
{
NCHW,
NHWC,
NCDHW,
NDHWC
NCHW, // BatchSize-Channels-Height-Width
NHWC, // BatchSize-Height-Width-Channels
NCDHW, // BatchSize-Channels-Depth-Height-Width
NDHWC, // BatchSize-Depth-Height-Width-Channels
NHW, // BatchSize-Height-Width
NFT, // BatchSize-Frequency-Time -> Frequency Major used for Spectrogram / MelfilterBank
NTF // BatchSize-Time-Frequency -> Time Major used for Spectrogram / MelfilterBank
} RpptLayout;

/*! \brief RPPT Tensor 2D ROI type enum
Expand Down Expand Up @@ -425,6 +428,15 @@ typedef enum
REFLECT
} RpptAudioBorderType;

/*! \brief RPPT Mel Scale Formula
* \ingroup group_rppdefs
*/
typedef enum
{
SLANEY = 0, // Follows Slaney’s MATLAB Auditory Modelling Work behavior
HTK, // Follows O’Shaughnessy’s book formula, consistent with Hidden Markov Toolkit(HTK), m = 2595 * log10(1 + (f/700))
} RpptMelScaleFormula;

/*! \brief RPPT Tensor 2D ROI LTRB struct
* \ingroup group_rppdefs
*/
Expand Down Expand Up @@ -1024,6 +1036,7 @@ typedef struct
Rpp64u* dstBatchIndex;
Rpp32u* inc;
Rpp32u* dstInc;
hipMemRpp32u scratchBuf;
} memGPU;

/*! \brief RPP HIP-HOST memory management
Expand Down
43 changes: 42 additions & 1 deletion include/rppt_tensor_audio_augmentations.h
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ extern "C" {
* \retval RPP_SUCCESS Successful completion.
* \retval RPP_ERROR* Unsuccessful completion.
*/
RppStatus rppt_non_silent_region_detection_host(RppPtr_t srcPtr, RpptDescPtr srcDescPtr, Rpp32s *srcLengthTensor, Rpp32f *detectedIndexTensor, Rpp32f *detectionLengthTensor, Rpp32f cutOffDB, Rpp32s windowLength, Rpp32f referencePower, Rpp32s resetInterval, rppHandle_t rppHandle);
RppStatus rppt_non_silent_region_detection_host(RppPtr_t srcPtr, RpptDescPtr srcDescPtr, Rpp32s *srcLengthTensor, Rpp32s *detectedIndexTensor, Rpp32s *detectionLengthTensor, Rpp32f cutOffDB, Rpp32s windowLength, Rpp32f referencePower, Rpp32s resetInterval, rppHandle_t rppHandle);

/*! \brief To Decibels augmentation on HOST backend
* \details To Decibels augmentation for 1D audio buffer converts magnitude values to decibel values
Expand Down Expand Up @@ -110,6 +110,47 @@ RppStatus rppt_pre_emphasis_filter_host(RppPtr_t srcPtr, RpptDescPtr srcDescPtr,
*/
RppStatus rppt_down_mixing_host(RppPtr_t srcPtr, RpptDescPtr srcDescPtr, RppPtr_t dstPtr, RpptDescPtr dstDescPtr, Rpp32s *srcDimsTensor, bool normalizeWeights, rppHandle_t rppHandle);

/*! \brief Produces a spectrogram from a 1D audio buffer on HOST backend
* \details Spectrogram for 1D audio buffer
* \param [in] srcPtr source tensor in HOST memory
* \param [in] srcDescPtr source tensor descriptor (Restrictions - numDims = 3, offsetInBytes >= 0, dataType = F32)
* \param [out] dstPtr destination tensor in HOST memory
* \param [in] dstDescPtr destination tensor descriptor (Restrictions - numDims = 3, offsetInBytes >= 0, dataType = F32, layout - NFT / NTF)
* \param [in] srcLengthTensor source audio buffer length (1D tensor in HOST memory, of size batchSize)
* \param [in] centerWindows indicates whether extracted windows should be padded so that the window function is centered at multiples of window_step
* \param [in] reflectPadding indicates the padding policy when sampling outside the bounds of the signal
* \param [in] windowFunction samples of the window function that will be multiplied to each extracted window when calculating the Short Time Fourier Transform (STFT)
* \param [in] nfft size of the FFT
* \param [in] power exponent of the magnitude of the spectrum
* \param [in] windowLength window size in number of samples
* \param [in] windowStep step between the STFT windows in number of samples
* \param [in] rppHandle RPP HOST handle created with <tt>\ref rppCreateWithBatchSize()</tt>
* \return A <tt> \ref RppStatus</tt> enumeration.
* \retval RPP_SUCCESS Successful completion.
* \retval RPP_ERROR* Unsuccessful completion.
*/
RppStatus rppt_spectrogram_host(RppPtr_t srcPtr, RpptDescPtr srcDescPtr, RppPtr_t dstPtr, RpptDescPtr dstDescPtr, Rpp32s *srcLengthTensor, bool centerWindows, bool reflectPadding, Rpp32f *windowFunction, Rpp32s nfft, Rpp32s power, Rpp32s windowLength, Rpp32s windowStep, rppHandle_t rppHandle);

/*! \brief Mel filter bank augmentation HOST backend
* \details Mel filter bank augmentation for audio data
* \param[in] srcPtr source tensor in HOST memory
* \param[in] srcDescPtr source tensor descriptor (Restrictions - numDims = 3, offsetInBytes >= 0, dataType = F32, layout - NFT)
* \param[out] dstPtr destination tensor in HOST memory
* \param[in] dstDescPtr destination tensor descriptor (Restrictions - numDims = 3, offsetInBytes >= 0, dataType = F32, layout - NFT)
* \param[in] srcDimsTensor source audio buffer length and number of channels (1D tensor in HOST memory, of size batchSize * 2)
* \param[in] maxFreq maximum frequency if not provided maxFreq = sampleRate / 2
* \param[in] minFreq minimum frequency
* \param[in] melFormula formula used to convert frequencies from hertz to mel and from mel to hertz (SLANEY / HTK)
* \param[in] numFilter number of mel filters
* \param[in] sampleRate sampling rate of the audio
* \param[in] normalize boolean variable that determine whether to normalize weights / not
* \param[in] rppHandle RPP HOST handle created with <tt>\ref rppCreateWithBatchSize()</tt>
* \return A <tt> \ref RppStatus</tt> enumeration.
* \retval RPP_SUCCESS Successful completion.
* \retval RPP_ERROR* Unsuccessful completion.
*/
RppStatus rppt_mel_filter_bank_host(RppPtr_t srcPtr, RpptDescPtr srcDescPtr, RppPtr_t dstPtr, RpptDescPtr dstDescPtr, Rpp32s *srcDims, Rpp32f maxFreq, Rpp32f minFreq, RpptMelScaleFormula melFormula, Rpp32s numFilter, Rpp32f sampleRate, bool normalize, rppHandle_t rppHandle);

/*! \brief Resample augmentation on HOST backend
* \details Resample augmentation for audio data
* \param[in] srcPtr source tensor in HOST memory
Expand Down
Loading