Skip to content

OPENMP and __GNUC__ compiler safety and performance #19025

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
53 changes: 25 additions & 28 deletions src/develop/openmp_maths.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,44 +23,41 @@
#pragma once


#if defined(_OPENMP) && !defined(_WIN32) && (!defined(__GNUC__) || __GNUC__ >= 12)
#if defined(_OPENMP) && !defined(_WIN32) && !defined(__GNUC__)
// GCC and CLANG have declarations in standard headers if and only if the architecture and compile options support vectorization, so
// don't try to override that here - causes dynamic-link errors at startup.
DT_OMP_DECLARE_SIMD()
extern float fmaxf(const float x, const float y);

#ifndef __GNUC__ // GCC 12 compiles but fails at runtime due to missing library function
DT_OMP_DECLARE_SIMD()
extern float fmaxf(const float x, const float y);
#endif
DT_OMP_DECLARE_SIMD()
extern float fminf(const float x, const float y);

#ifndef __GNUC__ // GCC 12 compiles but fails at runtime due to missing library function
DT_OMP_DECLARE_SIMD()
extern float fminf(const float x, const float y);
#endif
DT_OMP_DECLARE_SIMD()
extern float fabsf(const float x);

DT_OMP_DECLARE_SIMD()
extern float fabsf(const float x);

DT_OMP_DECLARE_SIMD()
extern float powf(const float x, const float y);
DT_OMP_DECLARE_SIMD()
extern float powf(const float x, const float y);

DT_OMP_DECLARE_SIMD()
extern float sqrtf(const float x);
DT_OMP_DECLARE_SIMD()
extern float sqrtf(const float x);

DT_OMP_DECLARE_SIMD()
extern float cbrtf(const float x);
DT_OMP_DECLARE_SIMD()
extern float cbrtf(const float x);

DT_OMP_DECLARE_SIMD()
extern float log2f(const float x);
DT_OMP_DECLARE_SIMD()
extern float log2f(const float x);

DT_OMP_DECLARE_SIMD()
extern float exp2f(const float x);
DT_OMP_DECLARE_SIMD()
extern float exp2f(const float x);

DT_OMP_DECLARE_SIMD()
extern float log10f(const float x);
DT_OMP_DECLARE_SIMD()
extern float log10f(const float x);

DT_OMP_DECLARE_SIMD()
extern float expf(const float x);
DT_OMP_DECLARE_SIMD()
extern float expf(const float x);

DT_OMP_DECLARE_SIMD()
extern float logf(const float x);
DT_OMP_DECLARE_SIMD()
extern float logf(const float x);

#endif

Expand Down
4 changes: 2 additions & 2 deletions src/iop/rawdenoise.c
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
This file is part of darktable,
Copyright (C) 2011-2024 darktable developers.
Copyright (C) 2011-2025 darktable developers.


darktable is free software: you can redistribute it and/or modify
Expand Down Expand Up @@ -226,7 +226,7 @@ static void wavelet_denoise(const float *const restrict in, float *const restric
const float *const restrict inp = in + (size_t)row * roi->width + offset;
const int senselwidth = (roi->width-offset+1)/2;
for(int col = 0; col < senselwidth; col++)
fimgp[col] = sqrtf(fmaxf(0.0f, inp[2*col]));
fimgp[col] = sqrtf(MAX(0.0f, inp[2*col]));
}

// perform the wavelet decomposition and denoising
Expand Down
Loading