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

PR2 - Audio - To decibels HOST Tensor #150

Merged

Conversation

snehaa8
Copy link

@snehaa8 snehaa8 commented Aug 3, 2023

No description provided.

@r-abishek r-abishek added the enhancement New feature or request label Sep 1, 2023
@r-abishek r-abishek added this to the sow9ms4 milestone Sep 1, 2023
Copy link
Owner

@r-abishek r-abishek left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@snehaa8 Please address comments. Also PR2 shows all changes from PR1 (nonsilentregion) too. Hope this should go away as we merge PR1 in, and pull master into PR2 later.

if(minRatio == 0.0f)
minRatio = std::nextafter(0.0f, 1.0f);

const Rpp32f log10Factor = 0.3010299956639812; //1 / std::log(10);
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Initialize as #define in rpp_cpu_common

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Initializing that as #define even at the start of this file lead to output mismatches, thus left it as such

Rpp32u numThreads = handle.GetNumThreads();

// Calculate the intermediate values needed for DB conversion
Rpp32f minRatio = std::pow(10, cutOffDB / multiplier);
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If user gives multiplier as 0, is there a check?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure added this check

{
*dstPtrCurrent = multiplier * std::log2(std::max(minRatio, (*srcPtrCurrent) * invReferenceMagnitude));
srcPtrCurrent++;
dstPtrCurrent++;
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use post increment ++ at L84, and make loop single line removing braces

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

{
*dstPtrTemp = multiplier * std::log2(std::max(minRatio, (*srcPtrTemp) * invReferenceMagnitude));
srcPtrTemp++;
dstPtrTemp++;
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same comment here on increments

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

if(minRatio == 0.0f)
minRatio = std::nextafter(0.0f, 1.0f);

const Rpp32f log10Factor = 0.3010299956639812; //1 / std::log(10);
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@snehaa8 Then instead of #define, lets just move the const Rpp32f as-is to rpp_cpu_common

@r-abishek r-abishek changed the base branch from master to ar/audio_support_2_to_decibels November 14, 2023 00:36
* \param[in] multiplier factor by which the logarithm is multiplied
* \param[in] referenceMagnitude Reference magnitude if not provided maximum value of input used as reference
* \param[in] rppHandle HIP-handle for "_gpu" variants and Host-handle for "_host" variants
* \return <tt> RppStatus enum</tt>.
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

needs to be before enum. Pls check non silent region and replicate

@@ -60,6 +60,25 @@ extern "C" {
*/
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);

/*! \brief To Decibels augmentation HOST
* \details To Decibels augmentation that converts magnitude values to decibel values
* \param[in] srcPtr source tensor memory
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lets specify HOST as per the new doxygen style

@@ -173,6 +195,29 @@ int main(int argc, char **argv)
maxWallTime = std::max(maxWallTime, wallTime);
minWallTime = std::min(minWallTime, wallTime);
avgWallTime += wallTime;

// QA mode - verify outputs with golden outputs. Below code doesn’t run for performance tests
if (testType == 0)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why did we increase to 8 reference outputs for to_decibels? QA has always been 3, non_silent_region has 3 too

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@snehaa8 Could you remove those reference outputs not needed?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done removed extra ones, it was 8 initially and Sampath made this change in NSR at a later point.

Copy link
Owner

@r-abishek r-abishek left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@snehaa8 Please issue a separate PR for changes mentioned.

@r-abishek r-abishek merged commit 072cc1e into r-abishek:ar/audio_support_2_to_decibels Nov 14, 2023
@snehaa8
Copy link
Author

snehaa8 commented Nov 15, 2023

However seeing
In file included from /dockerx/rpp_sn1/utilities/test_suite/HOST/../rpp_test_suite_audio.h:23:
/dockerx/rpp_sn1/utilities/test_suite/HOST/../rpp_test_suite_common.h:30:10: fatal error: 'filesystem.h' file not found
#include "filesystem.h"

on 54 machine, even for image tensor kernels.

r-abishek pushed a commit that referenced this pull request Apr 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
3 participants