Skip to content

Commit c59860b

Browse files
authored
YQL-15941 no_llvm versions of purecalc and embedded (#707)
* init * build
1 parent 33e5f8b commit c59860b

File tree

46 files changed

+494
-65
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

46 files changed

+494
-65
lines changed

ydb/library/yql/core/extract_predicate/ut/ya.make

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@ PEERDIR(
1818
ydb/library/yql/providers/result/provider
1919
ydb/library/yql/providers/yt/gateway/file
2020
ydb/library/yql/providers/yt/provider
21+
ydb/library/yql/providers/yt/codec/codegen
22+
ydb/library/yql/providers/yt/comp_nodes/llvm
2123
ydb/library/yql/minikql/comp_nodes/llvm
2224
ydb/library/yql/minikql/invoke_builtins/llvm
2325
ydb/library/yql/sql/pg

ydb/library/yql/core/ut/ya.make

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@ PEERDIR(
2828
ydb/library/yql/providers/result/provider
2929
ydb/library/yql/providers/yt/gateway/file
3030
ydb/library/yql/providers/yt/provider
31+
ydb/library/yql/providers/yt/codec/codegen
32+
ydb/library/yql/providers/yt/comp_nodes/llvm
3133
ydb/library/yql/minikql/comp_nodes/llvm
3234
ydb/library/yql/minikql/invoke_builtins/llvm
3335
ydb/library/yql/sql/pg

ydb/library/yql/minikql/codegen/codegen.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -230,6 +230,10 @@ namespace {
230230
}
231231
}
232232

233+
bool ICodegen::IsCodegenAvailable() {
234+
return true;
235+
}
236+
233237
class TCodegen : public ICodegen, private llvm::JITEventListener {
234238
public:
235239
TCodegen(ETarget target, ESanitize sanitize)

ydb/library/yql/minikql/codegen/codegen.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,8 @@ class ICodegen {
6767

6868
using TSharedPtr = std::shared_ptr<ICodegen>;
6969
static TSharedPtr MakeShared(ETarget target, ESanitize sanitize = ESanitize::Auto);
70+
71+
static bool IsCodegenAvailable();
7072
};
7173

7274
}
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
#include "codegen.h"
2+
3+
#include <util/generic/yexception.h>
4+
5+
namespace NYql {
6+
namespace NCodegen {
7+
8+
ICodegen::TPtr ICodegen::Make(ETarget target, ESanitize sanitize) {
9+
Y_UNUSED(target);
10+
Y_UNUSED(sanitize);
11+
throw yexception() << "Codegen is not available";
12+
}
13+
14+
ICodegen::TSharedPtr ICodegen::MakeShared(ETarget target, ESanitize sanitize) {
15+
Y_UNUSED(target);
16+
Y_UNUSED(sanitize);
17+
throw yexception() << "Codegen is not available";
18+
}
19+
20+
bool ICodegen::IsCodegenAvailable() {
21+
return false;
22+
}
23+
24+
}
25+
}
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
LIBRARY()
2+
3+
SRCDIR(
4+
ydb/library/yql/minikql/codegen
5+
)
6+
7+
ADDINCL(
8+
ydb/library/yql/minikql/codegen
9+
)
10+
11+
SRCS(
12+
codegen_dummy.cpp
13+
)
14+
15+
PROVIDES(MINIKQL_CODEGEN)
16+
17+
END()
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
RECURSE(llvm llvm14)
1+
RECURSE(no_llvm llvm llvm14)

ydb/library/yql/minikql/computation/mkql_computation_node_graph.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -779,7 +779,7 @@ class TComputationPatternImpl final : public IComputationPattern {
779779
#elif defined(MKQL_FORCE_USE_CODEGEN)
780780
: Codegen(NYql::NCodegen::ICodegen::MakeShared(NYql::NCodegen::ETarget::Native))
781781
#else
782-
: Codegen(opts.OptLLVM != "OFF" || GetEnv(TString("MKQL_FORCE_USE_LLVM")) ? NYql::NCodegen::ICodegen::MakeShared(NYql::NCodegen::ETarget::Native) : NYql::NCodegen::ICodegen::TPtr())
782+
: Codegen((NYql::NCodegen::ICodegen::IsCodegenAvailable() && opts.OptLLVM != "OFF") || GetEnv(TString("MKQL_FORCE_USE_LLVM")) ? NYql::NCodegen::ICodegen::MakeShared(NYql::NCodegen::ETarget::Native) : NYql::NCodegen::ICodegen::TPtr())
783783
#endif
784784
{
785785
/// TODO: Enable JIT for AARCH64

ydb/library/yql/providers/common/comp_nodes/ya.make

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -41,22 +41,6 @@ PEERDIR(
4141
ydb/library/yql/providers/common/schema/expr
4242
)
4343

44-
IF (NOT MKQL_DISABLE_CODEGEN)
45-
PEERDIR(
46-
ydb/library/yql/minikql/codegen/llvm
47-
contrib/libs/llvm12/lib/IR
48-
contrib/libs/llvm12/lib/ExecutionEngine/MCJIT
49-
contrib/libs/llvm12/lib/Linker
50-
contrib/libs/llvm12/lib/Target/X86
51-
contrib/libs/llvm12/lib/Target/X86/AsmParser
52-
contrib/libs/llvm12/lib/Transforms/IPO
53-
)
54-
ELSE()
55-
CFLAGS(
56-
-DMKQL_DISABLE_CODEGEN
57-
)
58-
ENDIF()
59-
6044
YQL_LAST_ABI_VERSION()
6145

6246
END()
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
LIBRARY()
2+
3+
ADDINCL(
4+
ydb/library/yql/providers/yt/codec/codegen
5+
)
6+
7+
SRCDIR(
8+
ydb/library/yql/providers/yt/codec/codegen
9+
)
10+
11+
SRCS(
12+
yt_codec_cg_dummy.cpp
13+
)
14+
15+
PEERDIR(
16+
)
17+
18+
PROVIDES(YT_CODEC_CODEGEN)
19+
20+
YQL_LAST_ABI_VERSION()
21+
22+
END()

ydb/library/yql/providers/yt/codec/codegen/ya.make

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,8 +72,14 @@ ENDIF()
7272

7373
YQL_LAST_ABI_VERSION()
7474

75+
PROVIDES(YT_CODEC_CODEGEN)
76+
7577
END()
7678

79+
RECURSE(
80+
no_llvm
81+
)
82+
7783
RECURSE_FOR_TESTS(
7884
ut
7985
)
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
#include "yt_codec_cg.h"
2+
3+
#include <util/generic/yexception.h>
4+
5+
namespace NYql {
6+
7+
TString GetYtCodecBitCode() {
8+
throw yexception() << "Codegen is not available";
9+
}
10+
11+
void YtCodecAddMappings(NCodegen::ICodegen& codegen) {
12+
Y_UNUSED(codegen);
13+
throw yexception() << "Codegen is not available";
14+
}
15+
16+
template<bool Flat>
17+
THolder<IYtCodecCgWriter> MakeYtCodecCgWriter(const std::unique_ptr<NCodegen::ICodegen>& codegen, const void* cookie) {
18+
Y_UNUSED(codegen);
19+
Y_UNUSED(cookie);
20+
throw yexception() << "Codegen is not available";
21+
}
22+
23+
template THolder<IYtCodecCgWriter> MakeYtCodecCgWriter<true>(const std::unique_ptr<NCodegen::ICodegen>& codegen, const void* cookie);
24+
template THolder<IYtCodecCgWriter> MakeYtCodecCgWriter<false>(const std::unique_ptr<NCodegen::ICodegen>& codegen, const void* cookie);
25+
26+
THolder<IYtCodecCgReader> MakeYtCodecCgReader(const std::unique_ptr<NCodegen::ICodegen>& codegen,
27+
const NKikimr::NMiniKQL::THolderFactory& holderFactory, const void* cookie) {
28+
Y_UNUSED(codegen);
29+
Y_UNUSED(holderFactory);
30+
Y_UNUSED(cookie);
31+
throw yexception() << "Codegen is not available";
32+
}
33+
34+
extern "C" void ThrowBadDecimal() {
35+
throw yexception() << "Codegen is not available";
36+
}
37+
38+
}
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
UNITTEST_FOR(ydb/library/yql/providers/yt/codec)
2+
3+
SRCDIR(
4+
ydb/library/yql/providers/yt/codec/ut
5+
)
6+
7+
SRCS(
8+
yt_codec_io_ut.cpp
9+
)
10+
11+
PEERDIR(
12+
library/cpp/yson/node
13+
ydb/library/yql/minikql/codegen/no_llvm
14+
ydb/library/yql/minikql/computation/no_llvm
15+
ydb/library/yql/public/udf/service/exception_policy
16+
ydb/library/yql/sql
17+
ydb/library/yql/sql/pg_dummy
18+
ydb/library/yql/providers/common/codec
19+
ydb/library/yql/providers/common/mkql
20+
ydb/library/yql/providers/yt/lib/yson_helpers
21+
ydb/library/yql/providers/yt/codec/codegen/no_llvm
22+
)
23+
24+
YQL_LAST_ABI_VERSION()
25+
26+
END()

ydb/library/yql/providers/yt/codec/ut/ya.make

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ PEERDIR(
1313
ydb/library/yql/providers/common/codec
1414
ydb/library/yql/providers/common/mkql
1515
ydb/library/yql/providers/yt/lib/yson_helpers
16+
ydb/library/yql/providers/yt/codec/codegen
1617
)
1718

1819
YQL_LAST_ABI_VERSION()

ydb/library/yql/providers/yt/codec/ya.make

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,7 @@ PEERDIR(
2626
ydb/library/yql/providers/yt/lib/skiff
2727
)
2828

29-
IF (NOT MKQL_DISABLE_CODEGEN)
30-
PEERDIR(
31-
ydb/library/yql/providers/yt/codec/codegen
32-
)
33-
ELSE()
29+
IF (MKQL_DISABLE_CODEGEN)
3430
CFLAGS(
3531
-DMKQL_DISABLE_CODEGEN
3632
)
@@ -46,4 +42,5 @@ RECURSE(
4642

4743
RECURSE_FOR_TESTS(
4844
ut
45+
ut/no_llvm
4946
)

ydb/library/yql/providers/yt/codec/yt_codec_io.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1469,7 +1469,7 @@ void TMkqlReaderImpl::SetSpecs(const TMkqlIOSpecs& specs, const NKikimr::NMiniKQ
14691469
Buf_.SetStats(JobStats_);
14701470
if (Specs_->UseSkiff_) {
14711471
#ifndef MKQL_DISABLE_CODEGEN
1472-
if (Specs_->OptLLVM_ != "OFF") {
1472+
if (Specs_->OptLLVM_ != "OFF" && NCodegen::ICodegen::IsCodegenAvailable()) {
14731473
Decoder_.Reset(new TSkiffLLVMDecoder(Buf_, *Specs_, holderFactory));
14741474
}
14751475
else
@@ -1976,7 +1976,7 @@ void TMkqlWriterImpl::SetSpecs(const TMkqlIOSpecs& specs, const TVector<TString>
19761976

19771977
#ifndef MKQL_DISABLE_CODEGEN
19781978
THashMap<TStructType*, std::pair<llvm::Function*, llvm::Function*>> llvmFunctions;
1979-
if (Specs_->UseSkiff_ && Specs_->OptLLVM_ != "OFF") {
1979+
if (Specs_->UseSkiff_ && Specs_->OptLLVM_ != "OFF" && NCodegen::ICodegen::IsCodegenAvailable()) {
19801980
for (size_t i: xrange(Specs_->Outputs.size())) {
19811981
auto rowType = Specs_->Outputs[i].RowType;
19821982
if (rowType->GetMembersCount() != 0 && !llvmFunctions.contains(rowType)) {

ydb/library/yql/providers/yt/comp_nodes/dq/dq_yt_block_reader.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -624,4 +624,4 @@ IComputationNode* CreateDqYtReadBlockWrapper(const TComputationNodeFactoryContex
624624
{
625625
return new TDqYtReadBlockWrapper(ctx, clusterName, token, inputSpec, samplingSpec, inputGroups, itemType, tableNames, std::move(tables), jobStats, inflight, timeout);
626626
}
627-
}
627+
}

ydb/library/yql/providers/yt/comp_nodes/dq/ya.make

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ LIBRARY()
33
PEERDIR(
44
ydb/library/yql/minikql
55
ydb/library/yql/minikql/computation/llvm
6-
ydb/library/yql/minikql/computation
76
ydb/library/yql/providers/yt/comp_nodes
87
ydb/library/yql/providers/yt/codec
98
ydb/library/yql/providers/common/codec
@@ -45,8 +44,6 @@ SRCS(
4544
dq_yt_writer.cpp
4645
)
4746

48-
INCLUDE(../../../../minikql/computation/header.ya.make.inc)
49-
5047
YQL_LAST_ABI_VERSION()
5148

5249

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
LIBRARY()
2+
3+
OWNER(
4+
g:yql
5+
g:yql_ydb_core
6+
)
7+
8+
NO_COMPILER_WARNINGS()
9+
10+
PEERDIR(
11+
ydb/library/yql/minikql/codegen/llvm
12+
ydb/library/yql/minikql/invoke_builtins/llvm
13+
contrib/libs/llvm12/lib/IR
14+
contrib/libs/llvm12/lib/ExecutionEngine/MCJIT
15+
contrib/libs/llvm12/lib/Linker
16+
contrib/libs/llvm12/lib/Target/X86
17+
contrib/libs/llvm12/lib/Target/X86/AsmParser
18+
contrib/libs/llvm12/lib/Transforms/IPO
19+
)
20+
21+
INCLUDE(../ya.make.inc)
22+
23+
END()
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
LIBRARY()
2+
3+
OWNER(
4+
g:yql
5+
g:yql_ydb_core
6+
)
7+
8+
NO_COMPILER_WARNINGS()
9+
10+
PEERDIR(
11+
ydb/library/yql/minikql/codegen/llvm14
12+
ydb/library/yql/minikql/invoke_builtins/llvm14
13+
contrib/libs/llvm14/lib/IR
14+
contrib/libs/llvm14/lib/ExecutionEngine/MCJIT
15+
contrib/libs/llvm14/lib/Linker
16+
contrib/libs/llvm14/lib/Target/X86
17+
contrib/libs/llvm14/lib/Target/X86/AsmParser
18+
contrib/libs/llvm14/lib/Transforms/IPO
19+
)
20+
21+
INCLUDE(../ya.make.inc)
22+
23+
END()
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
LIBRARY()
2+
3+
OWNER(
4+
g:yql
5+
g:yql_ydb_core
6+
)
7+
8+
CXXFLAGS(-DMKQL_DISABLE_CODEGEN)
9+
10+
ADDINCL(GLOBAL ydb/library/yql/minikql/codegen/llvm_stub)
11+
12+
INCLUDE(../ya.make.inc)
13+
14+
PEERDIR(ydb/library/yql/minikql/invoke_builtins/no_llvm)
15+
16+
END()

0 commit comments

Comments
 (0)