Skip to content
This repository has been archived by the owner on May 9, 2024. It is now read-only.

Commit

Permalink
[Warns] Reduce warnings amount
Browse files Browse the repository at this point in the history
This commit is an initial step to remove warnings from build. Currently
it's focused on linux build.

Always_inline attribute warning works incorrectly. In this case we want
to keep symbol and than inline it during target llvm ir optimisation.

See also: #521

Signed-off-by: Dmitrii Makarenko <[email protected]>
  • Loading branch information
Devjiu committed Jun 14, 2023
1 parent 1700736 commit 6d4c150
Show file tree
Hide file tree
Showing 11 changed files with 27 additions and 15 deletions.
1 change: 1 addition & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ project(

set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_SUPPRESS_DEVELOPER_WARNINGS 1 CACHE INTERNAL "No dev warnings")

set(CMAKE_EXPORT_COMPILE_COMMANDS ON)

Expand Down
9 changes: 8 additions & 1 deletion omniscidb/IR/Node.h
Original file line number Diff line number Diff line change
Expand Up @@ -591,7 +591,14 @@ class TranslatedJoin : public Node {
CHECK(false);
return nullptr;
}
const std::string& getFieldName(size_t i) const override { CHECK(false); }
const std::string& getFieldName(size_t i) const override {
CHECK(false);
// Check(false) macro have abort in Logger d-tor,
// but gcc can't correctly find this escape sequence.
// WA to remove noreturn warning.
// TODO(anyone) check this warning with clang
abort();
}
std::vector<const ColumnVar*> getJoinCols(bool lhs) const {
if (lhs) {
return lhs_join_cols_;
Expand Down
3 changes: 2 additions & 1 deletion omniscidb/QueryEngine/CardinalityEstimator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,8 @@ RelAlgExecutionUnit create_ndv_execution_unit(const RelAlgExecutionUnit& ra_exe_
auto tinfo = schema_provider->getTableInfo(outer_input_it->getDatabaseId(),
outer_input_it->getTableId());
CHECK(tinfo);
if (tinfo->row_count < config.exec.group_by.large_ndv_threshold) {
if (static_cast<int64_t>(tinfo->row_count) <
config.exec.group_by.large_ndv_threshold) {
LOG(INFO) << "Avoid large estimator because of the small input ("
<< tinfo->row_count << " rows).";
use_large_estimator = false;
Expand Down
4 changes: 4 additions & 0 deletions omniscidb/QueryEngine/DateTruncate.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@
#include <ctime>
#include <limits>

#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wattributes"
#define DATE_TRUNC_FUNC_JIT(funcname) \
extern "C" RUNTIME_EXPORT ALWAYS_INLINE DEVICE int64_t funcname(int64_t timeval) { \
return funcname##_##impl(timeval); \
Expand Down Expand Up @@ -514,3 +516,5 @@ DateDiffHighPrecisionNullable(const hdk::ir::DateTruncField datepart,
}
return DateDiffHighPrecision(datepart, startdate, enddate, start_dim, end_dim);
}

#pragma GCC diagnostic pop
5 changes: 2 additions & 3 deletions omniscidb/QueryEngine/Execute.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1898,9 +1898,8 @@ Executor::getExecutionPolicyForTargets(const RelAlgExecutionUnit& ra_exe_unit,
<< toString(ra_exe_unit.templs) << " cost_model=" << ra_exe_unit.cost_model
<< ", cost model in config: "
<< (config_->exec.enable_cost_model ? "enabled" : "disabled")
<< ", heterogeneous execution: " << cfg.enable_heterogeneous_execution
? "enabled"
: "disabled";
<< ", heterogeneous execution: "
<< (cfg.enable_heterogeneous_execution ? "enabled" : "disabled");

if (cfg.enable_heterogeneous_execution) {
if (cfg.forced_heterogeneous_distribution) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,6 @@ class AnnotateInternalFunctionsPass
llvm::CGSCCAnalysisManager& AM,
llvm::LazyCallGraph& CG,
llvm::CGSCCUpdateResult& UR) {
bool updated_function_defs = false;

#if 0
for (llvm::LazyCallGraph::Node& N : InitialC) {
llvm::Function* Fn = &N.getFunction();
Expand All @@ -57,7 +55,6 @@ class AnnotateInternalFunctionsPass
}
if (isInternalStatelessFunction(fcn->getName()) ||
isInternalMathFunction(fcn->getName())) {
updated_function_defs = true;
std::vector<llvm::Attribute::AttrKind> attrs{llvm::Attribute::NoFree,
llvm::Attribute::NoSync,
llvm::Attribute::NoUnwind,
Expand All @@ -68,7 +65,6 @@ class AnnotateInternalFunctionsPass
fcn->addFnAttr(attr);
}
} else if (isReadOnlyFunction(fcn->getName())) {
updated_function_defs = true;
fcn->addFnAttr(llvm::Attribute::ReadOnly);
}
}
Expand Down
1 change: 0 additions & 1 deletion omniscidb/ResultSet/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ set(result_set_source_files
StreamingTopN.cpp
TargetValue.cpp
)

add_library(ResultSet ${result_set_source_files})

target_link_libraries(ResultSet DataMgr IR Logger Utils StringDictionary ${Folly_LIBRARIES})
3 changes: 3 additions & 0 deletions omniscidb/ResultSet/ResultSetStorage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@ int8_t* VarlenOutputInfo::computeCpuOffset(const int64_t gpu_offset_address) con

namespace {

#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wattributes"
ALWAYS_INLINE
void fill_empty_key_32(int32_t* key_ptr_i32, const size_t key_count) {
for (size_t i = 0; i < key_count; ++i) {
Expand All @@ -64,6 +66,7 @@ void fill_empty_key_64(int64_t* key_ptr_i64, const size_t key_count) {
key_ptr_i64[i] = EMPTY_KEY_64;
}
}
#pragma GCC diagnostic pop

template <typename T>
inline size_t make_bin_search(size_t l, size_t r, T&& is_empty_fn) {
Expand Down
2 changes: 0 additions & 2 deletions omniscidb/ResultSet/TargetValue.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@
* SPDX-License-Identifier: Apache-2.0
*/

#pragma once

#include "TargetValue.h"

#include "IR/Type.h"
Expand Down
6 changes: 3 additions & 3 deletions omniscidb/Tests/ArrowStorageTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
*/

#include "ArrowStorage/ArrowStorage.h"
#include "Shared/ArrowUtil.h"

#include "TestHelpers.h"

Expand Down Expand Up @@ -736,11 +737,10 @@ TEST_F(ArrowStorageTest, ImportArrowTable) {
ArrowStorage storage(TEST_SCHEMA_ID, "test", TEST_DB_ID, config_);
auto col_a = std::make_shared<arrow::Field>("A", arrow::null());
auto schema = arrow::schema({col_a});

std::shared_ptr<arrow::Array> empty_array;
arrow::NumericBuilder<arrow::FloatType> float64_builder;
float64_builder.AppendValues({});
float64_builder.Finish(&empty_array);
ARROW_THROW_NOT_OK(float64_builder.AppendValues({}));
ARROW_THROW_NOT_OK(float64_builder.Finish(&empty_array));
auto table = arrow::Table::Make(schema, {empty_array});
ASSERT_NO_THROW(
storage.importArrowTable(table, "test_empty", ArrowStorage::TableOptions{1}));
Expand Down
4 changes: 4 additions & 0 deletions omniscidb/Utils/ExtractFromTime.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,9 @@ DEVICE unsigned week_start_from_yoe(unsigned const yoe) {

} // namespace

#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wattributes"

extern "C" RUNTIME_EXPORT ALWAYS_INLINE DEVICE int64_t
extract_hour(const int64_t lcltime) {
return unsigned_mod(lcltime, kSecsPerDay) / kSecsPerHour;
Expand Down Expand Up @@ -267,6 +270,7 @@ extract_year(const int64_t timeval) {
return 2000 + era * 400 + yoe + (MARJAN <= doy);
}

#pragma GCC diagnostic pop
/*
* @brief support the SQL EXTRACT function
*/
Expand Down

0 comments on commit 6d4c150

Please sign in to comment.