Skip to content

Commit

Permalink
Enable -Winfinite-recursion in deeplearning/PACKAGE (pytorch#2329)
Browse files Browse the repository at this point in the history
Summary:
Pull Request resolved: pytorch#2329

This diff enables the titular warning flag for the directory in question. Further details are in [this workplace post](https://fb.workplace.com/permalink.php?story_fbid=pfbid02XaWNiCVk69r1ghfvDVpujB8Hr9Y61uDvNakxiZFa2jwiPHscVdEQwCBHrmWZSyMRl&id=100051201402394).

This is a low-risk diff. There are **no run-time effects** and the diff has already been observed to compile locally. **If the code compiles, it works; test errors are spurious.**

If the diff does not pass, it will be closed automatically.

Reviewed By: palmje

Differential Revision: D53530303

fbshipit-source-id: 66000f69a67e80196f16c423d4bd12c52ce047c5
  • Loading branch information
r-barnes authored and facebook-github-bot committed Feb 17, 2024
1 parent 66a8779 commit 89c52b0
Showing 1 changed file with 24 additions and 9 deletions.
33 changes: 24 additions & 9 deletions include/fbgemm/Fbgemm.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,26 @@
#include "./Types.h"
#include "./Utils.h"

#ifdef __clang__
// clang-format off
#define FBGEMM_PUSH_WARNING _Pragma("GCC diagnostic push")
#define FBGEMM_DISABLE_WARNING_INTERNAL2(warningName) #warningName
#define FBGEMM_DISABLE_WARNING(warningName) \
_Pragma( \
FBGEMM_DISABLE_WARNING_INTERNAL2(GCC diagnostic ignored warningName))
#define FBGEMM_PUSH_WARNING_AND_DISABLE(warningName) \
_Pragma("GCC diagnostic push") \
_Pragma( \
FBGEMM_DISABLE_WARNING_INTERNAL2(GCC diagnostic ignored warningName))
#define FBGEMM_POP_WARNING _Pragma("GCC diagnostic pop")
// clang-format on
#else
#define FBGEMM_PUSH_WARNING
#define FBGEMM_DISABLE_WARNING(NAME)
#define FBGEMM_PUSH_WARNING_AND_DISABLE(NAME)
#define FBGEMM_POP_WARNING
#endif

// Turning on this option will print out time breakdown of each stage (e.g.,
// input packing, the main GEMM kernel, each output processing pipeline).
// Please note that currently this option won't report accurate timing if
Expand Down Expand Up @@ -139,23 +159,17 @@ class PackMatrix {
int cols = 0,
const BlockingFactors* params = nullptr);

#if defined(__clang__)
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winfinite-recursion"
#endif

FBGEMM_PUSH_WARNING_AND_DISABLE("-Winfinite-recursion")
/**
* @return Pointer to a buffer containing row offset results. Some packing
* objects fuse row offset computation for later requantization step.
*/
std::int32_t* getRowOffsetBuffer() const {
return static_cast<const PT*>(this)->getRowOffsetBuffer();
}
FBGEMM_POP_WARNING

#if defined(__clang__)
#pragma clang diagnostic pop
#endif

FBGEMM_PUSH_WARNING_AND_DISABLE("-Winfinite-recursion")
/**
* @brief When k loop is also tiled/blocked, this function is used to check if
* have executed computations for the last k block so that we can perform
Expand All @@ -164,6 +178,7 @@ class PackMatrix {
bool isThisLastKBlock(int block_id) const {
return static_cast<const PT*>(this)->isThisLastKBlock(block_id);
}
FBGEMM_POP_WARNING

/**
* @brief Actual packing of a block of the source matrix in pmat buffer.
Expand Down

0 comments on commit 89c52b0

Please sign in to comment.