Skip to content
Closed

Vs2022 2 #51784

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
15 changes: 8 additions & 7 deletions .bazelrc
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ build:strict --incompatible_strict_action_env
build --action_env=RAY_BUILD_ENV

###############################################################################
# On Windows, provide: BAZEL_SH, and BAZEL_LLVM (if using clang-cl)
# On Windows, provide: BAZEL_SH, and BAZEL_LLVM
# On all platforms, provide: PYTHON3_BIN_PATH=python
###############################################################################
build:windows --action_env=PATH
Expand All @@ -18,12 +18,12 @@ build --compilation_mode=opt
# Using C++ 17 on all platforms.
build:linux --host_cxxopt="-std=c++17"
build:macos --host_cxxopt="-std=c++17"
build:clang-cl --host_cxxopt="-std=c++17"
build:clang-cl --host_cxxopt="-std:c++17"
build:msvc-cl --host_cxxopt="/std:c++17"
build:windows --host_cxxopt="/std:c++17"
build:linux --cxxopt="-std=c++17"
build:macos --cxxopt="-std=c++17"
build:clang-cl --cxxopt="-std=c++17"
build:clang-cl --cxxopt="-std:c++17"
build:msvc-cl --cxxopt="/std:c++17"
build:windows --cxxopt="/std:c++17"
# This workaround is needed to prevent Bazel from compiling the same file twice (once PIC and once not).
Expand All @@ -50,10 +50,10 @@ build:windows --enable_runfiles
# TODO(mehrdadn): Revert the "-\\.(asm|S)$" exclusion when this Bazel bug
# for compiling assembly files is fixed on Windows:
# https://github.com/bazelbuild/bazel/issues/8924
# Warnings should be errors
build:linux --per_file_copt="-\\.(asm|S)$@-Werror"
build:macos --per_file_copt="-\\.(asm|S)$@-Werror"
build:clang-cl --per_file_copt="-\\.(asm|S)$@-Werror"
# Warnings should be errors, except for deprecated protobuf CreateMessage use
build:linux --per_file_copt="-\\.(asm|S)$@-Werror,-Wno-deprecated-declarations"
build:macos --per_file_copt="-\\.(asm|S)$@-Werror,-Wno-deprecated-declarations"
build:clang-cl --per_file_copt="-\\.(asm|S)$@-Werror,-Wno-deprecated-declarations"
build:msvc-cl --per_file_copt="-\\.(asm|S)$@-WX"
# Ignore warnings for protobuf generated files and external projects.
build --per_file_copt="\\.pb\\.cc$@-w"
Expand Down Expand Up @@ -222,3 +222,4 @@ try-import %workspace%/.llvm-local.bazelrc
build:macos --sandbox_block_path=/usr/local/
# This option controls whether javac checks for missing direct dependencies.
build --experimental_strict_java_deps=off
build:clang-cl --per_file_copt="-external/com_github_redis_hiredis/ssl.c$@-Wno-parenthesis,-Wno-int-conversion"
1 change: 1 addition & 0 deletions WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ python_register_toolchains(
name = "python3_9",
python_version = "3.9",
register_toolchains = False,
ignore_root_user_error = True,
)

load("@python3_9//:defs.bzl", python39 = "interpreter")
Expand Down
30 changes: 13 additions & 17 deletions bazel/ray_deps_setup.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -86,20 +86,16 @@ def auto_http_archive(
def ray_deps_setup():
# Explicitly bring in protobuf dependency to work around
# https://github.com/ray-project/ray/issues/14117
# This is copied from grpc's bazel/grpc_deps.bzl
#
# Pinned grpc version: v23.4
http_archive(
name = "com_google_protobuf",
sha256 = "76a33e2136f23971ce46c72fd697cd94dc9f73d56ab23b753c3e16854c90ddfd",
strip_prefix = "protobuf-2c5fa078d8e86e5f4bd34e6f4c9ea9e8d7d4d44a",
sha256 = "b2340aa47faf7ef10a0328190319d3f3bee1b24f426d4ce8f4253b6f27ce16db",
strip_prefix = "protobuf-28.2",
urls = [
"https://github.com/protocolbuffers/protobuf/archive/2c5fa078d8e86e5f4bd34e6f4c9ea9e8d7d4d44a.tar.gz",
"https://github.com/protocolbuffers/protobuf/archive/refs/tags/v28.2.tar.gz",
],
patches = [
"@com_github_grpc_grpc//third_party:protobuf.patch",
"@com_github_ray_project_ray//thirdparty/patches:protobuf-windows-const-nan.patch",
],
patch_args = ["-p1"],
)

# NOTE(lingxuan.zlx): 3rd party dependencies could be accessed, so it suggests
Expand Down Expand Up @@ -229,10 +225,10 @@ def ray_deps_setup():
# TODO(owner): Upgrade abseil to latest version after protobuf updated, which requires to upgrade `rules_cc` first.
auto_http_archive(
name = "com_google_absl",
sha256 = "987ce98f02eefbaf930d6e38ab16aa05737234d7afbab2d5c4ea7adbe50c28ed",
strip_prefix = "abseil-cpp-20230802.1",
sha256 = "f50e5ac311a81382da7fa75b97310e4b9006474f9560ac46f54a9967f07d4ae3",
strip_prefix = "abseil-cpp-20240722.0",
urls = [
"https://github.com/abseil/abseil-cpp/archive/refs/tags/20230802.1.tar.gz",
"https://github.com/abseil/abseil-cpp/archive/refs/tags/20240722.0.tar.gz",
],
)

Expand All @@ -252,8 +248,8 @@ def ray_deps_setup():
auto_http_archive(
name = "com_github_grpc_grpc",
# NOTE: If you update this, also update @boringssl's hash.
url = "https://github.com/grpc/grpc/archive/refs/tags/v1.57.1.tar.gz",
sha256 = "0762f809b9de845e6a7c809cabccad6aa4143479fd43b396611fe5a086c0aeeb",
url = "https://github.com/grpc/grpc/archive/refs/tags/v1.67.1.tar.gz",
sha256 = "d74f8e99a433982a12d7899f6773e285c9824e1d9a173ea1d1fb26c9bd089299",
patches = [
"@com_github_ray_project_ray//thirdparty/patches:grpc-cython-copts.patch",
],
Expand Down Expand Up @@ -295,13 +291,13 @@ def ray_deps_setup():
http_archive(
# This rule is used by @com_github_grpc_grpc, and using a GitHub mirror
# provides a deterministic archive hash for caching. Explanation here:
# https://github.com/grpc/grpc/blob/1ff1feaa83e071d87c07827b0a317ffac673794f/bazel/grpc_deps.bzl#L189
# Ensure this rule matches the rule used by grpc's bazel/grpc_deps.bzl
# https://github.com/grpc/grpc/blob/v1.67.1/bazel/grpc_deps.bzl#L33
name = "boringssl",
sha256 = "0675a4f86ce5e959703425d6f9063eaadf6b61b7f3399e77a154c0e85bad46b1",
strip_prefix = "boringssl-342e805bc1f5dfdd650e3f031686d6c939b095d9",
sha256 = "c70d519e4ee709b7a74410a5e3a937428b8198d793a3d771be3dd2086ae167c8",
strip_prefix = "boringssl-b8b3e6e11166719a8ebfa43c0cde9ad7d57a84f6",
urls = [
"https://github.com/google/boringssl/archive/342e805bc1f5dfdd650e3f031686d6c939b095d9.tar.gz",
"https://github.com/google/boringssl/archive/b8b3e6e11166719a8ebfa43c0cde9ad7d57a84f6.tar.gz",
],
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ TEST_F(TaskEventTestWriteExport, TestWriteTaskExportEvents) {
auto task_ids = GenTaskIDs(num_events);
google::protobuf::util::JsonPrintOptions options;
options.preserve_proto_field_names = true;
options.always_print_primitive_fields = true;
options.always_print_fields_with_no_presence = true;

std::vector<SourceTypeVariant> source_types = {
rpc::ExportEvent_SourceType::ExportEvent_SourceType_EXPORT_TASK};
Expand Down
21 changes: 7 additions & 14 deletions src/ray/gcs/gcs_server/test/gcs_actor_manager_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1288,8 +1288,7 @@ TEST_F(GcsActorManagerTest, TestGetAllActorInfoFilters) {
rpc::GetAllActorInfoRequest request;
request.mutable_filters()->set_actor_id(actor->GetActorID().Binary());

auto &reply =
*google::protobuf::Arena::CreateMessage<rpc::GetAllActorInfoReply>(&arena);
auto &reply = *google::protobuf::Arena::Create<rpc::GetAllActorInfoReply>(&arena);
gcs_actor_manager_->HandleGetAllActorInfo(request, &reply, callback);
ASSERT_EQ(reply.actor_table_data().size(), 1);
ASSERT_EQ(reply.total(), 1 + num_other_actors);
Expand All @@ -1301,8 +1300,7 @@ TEST_F(GcsActorManagerTest, TestGetAllActorInfoFilters) {
rpc::GetAllActorInfoRequest request;
request.mutable_filters()->set_job_id(job_id.Binary());

auto &reply =
*google::protobuf::Arena::CreateMessage<rpc::GetAllActorInfoReply>(&arena);
auto &reply = *google::protobuf::Arena::Create<rpc::GetAllActorInfoReply>(&arena);
gcs_actor_manager_->HandleGetAllActorInfo(request, &reply, callback);
ASSERT_EQ(reply.actor_table_data().size(), 1);
ASSERT_EQ(reply.num_filtered(), num_other_actors);
Expand All @@ -1313,8 +1311,7 @@ TEST_F(GcsActorManagerTest, TestGetAllActorInfoFilters) {
rpc::GetAllActorInfoRequest request;
request.mutable_filters()->set_state(rpc::ActorTableData::ALIVE);

auto &reply =
*google::protobuf::Arena::CreateMessage<rpc::GetAllActorInfoReply>(&arena);
auto &reply = *google::protobuf::Arena::Create<rpc::GetAllActorInfoReply>(&arena);
gcs_actor_manager_->HandleGetAllActorInfo(request, &reply, callback);
ASSERT_EQ(reply.actor_table_data().size(), 1);
ASSERT_EQ(reply.num_filtered(), num_other_actors);
Expand All @@ -1326,8 +1323,7 @@ TEST_F(GcsActorManagerTest, TestGetAllActorInfoFilters) {
request.mutable_filters()->set_state(rpc::ActorTableData::ALIVE);
request.mutable_filters()->set_job_id(job_id.Binary());

auto &reply =
*google::protobuf::Arena::CreateMessage<rpc::GetAllActorInfoReply>(&arena);
auto &reply = *google::protobuf::Arena::Create<rpc::GetAllActorInfoReply>(&arena);
gcs_actor_manager_->HandleGetAllActorInfo(request, &reply, callback);
ASSERT_EQ(reply.actor_table_data().size(), 1);
ASSERT_EQ(reply.num_filtered(), num_other_actors);
Expand All @@ -1337,8 +1333,7 @@ TEST_F(GcsActorManagerTest, TestGetAllActorInfoFilters) {
request.mutable_filters()->set_state(rpc::ActorTableData::DEAD);
request.mutable_filters()->set_job_id(job_id.Binary());

auto &reply =
*google::protobuf::Arena::CreateMessage<rpc::GetAllActorInfoReply>(&arena);
auto &reply = *google::protobuf::Arena::Create<rpc::GetAllActorInfoReply>(&arena);
gcs_actor_manager_->HandleGetAllActorInfo(request, &reply, callback);
ASSERT_EQ(reply.num_filtered(), num_other_actors + 1);
ASSERT_EQ(reply.actor_table_data().size(), 0);
Expand All @@ -1362,17 +1357,15 @@ TEST_F(GcsActorManagerTest, TestGetAllActorInfoLimit) {

{
rpc::GetAllActorInfoRequest request;
auto &reply =
*google::protobuf::Arena::CreateMessage<rpc::GetAllActorInfoReply>(&arena);
auto &reply = *google::protobuf::Arena::Create<rpc::GetAllActorInfoReply>(&arena);
auto callback = [](Status status,
std::function<void()> success,
std::function<void()> failure) {};
gcs_actor_manager_->HandleGetAllActorInfo(request, &reply, callback);
ASSERT_EQ(reply.actor_table_data().size(), 3);

request.set_limit(2);
auto &reply_2 =
*google::protobuf::Arena::CreateMessage<rpc::GetAllActorInfoReply>(&arena);
auto &reply_2 = *google::protobuf::Arena::Create<rpc::GetAllActorInfoReply>(&arena);
gcs_actor_manager_->HandleGetAllActorInfo(request, &reply_2, callback);
ASSERT_EQ(reply_2.actor_table_data().size(), 2);
ASSERT_EQ(reply_2.total(), 3);
Expand Down
3 changes: 1 addition & 2 deletions src/ray/raylet_client/raylet_client.cc
Original file line number Diff line number Diff line change
Expand Up @@ -245,8 +245,7 @@ void RayletClient::RequestWorkerLease(
const int64_t backlog_size,
const bool is_selected_based_on_locality) {
google::protobuf::Arena arena;
auto request =
google::protobuf::Arena::CreateMessage<rpc::RequestWorkerLeaseRequest>(&arena);
auto request = google::protobuf::Arena::Create<rpc::RequestWorkerLeaseRequest>(&arena);
// The unsafe allocating here is actually safe because the life-cycle of
// task_spec is longer than request.
// Request will be sent before the end of this call, and after that, it won't be
Expand Down
2 changes: 1 addition & 1 deletion src/ray/rpc/server_call.h
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ class ServerCallImpl : public ServerCall {
cluster_id_(cluster_id),
start_time_(0),
record_metrics_(record_metrics) {
reply_ = google::protobuf::Arena::CreateMessage<Reply>(&arena_);
reply_ = google::protobuf::Arena::Create<Reply>(&arena_);
// TODO(Yi Cheng) call_name_ sometimes get corrunpted due to memory issues.
RAY_CHECK(!call_name_.empty()) << "Call name is empty";
if (record_metrics_) {
Expand Down
2 changes: 1 addition & 1 deletion src/ray/util/event.cc
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ std::string LogEventReporter::ExportEventToString(const rpc::ExportEvent &export
google::protobuf::util::JsonPrintOptions options;
options.preserve_proto_field_names = true;
// Required so enum with value 0 is not omitted
options.always_print_primitive_fields = true;
options.always_print_fields_with_no_presence = true;
if (export_event.has_task_event_data()) {
RAY_CHECK(google::protobuf::util::MessageToJsonString(
export_event.task_event_data(), &event_data_as_string, options)
Expand Down
46 changes: 46 additions & 0 deletions thirdparty/patches/protobuf-windows-const-nan.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
diff -u upb/message/internal/message.c /tmp/message.c
--- upb/message/internal/message.c
+++ upb/message/internal/message.c
@@ -19,6 +19,26 @@

const float kUpb_FltInfinity = INFINITY;
const double kUpb_Infinity = INFINITY;
-const double kUpb_NaN = NAN;
+
+// The latest win32 SDKs have an invalid definition of NAN.
+// https://developercommunity.visualstudio.com/t/NAN-is-no-longer-compile-time-constant-i/10688907
+//
+// Unfortunately, the `0.0 / 0.0` workaround doesn't work in Clang under C23, so
+// try __builtin_nan first, if that exists.
+#ifdef _WIN32
+#ifdef __has_builtin
+#if __has_builtin(__builtin_nan)
+#define UPB_NAN __builtin_nan("0")
+#endif
+#endif
+#ifndef UPB_NAN
+#define UPB_NAN 0.0 / 0.0
+#endif
+#else
+// For !_WIN32, assume math.h works.
+#define UPB_NAN NAN
+#endif
+const double kUpb_NaN = UPB_NAN;
+

bool UPB_PRIVATE(_upb_Message_Realloc)(struct upb_Message* msg, size_t need,

diff --git .bazelrc .bazelrc
--- .bazelrc
+++ .bazelrc
@@ -1,4 +1,9 @@
-build --cxxopt=-std=c++17 --host_cxxopt=-std=c++17
+build --enable_platform_specific_config
+build:linux --cxxopt=-std=c++17 --host_cxxopt=-std=c++17
+build:macos --cxxopt=-std=c++17 --host_cxxopt=-std=c++17
+build:windows --compiler=clang-cl
+build:windows --cxxopt=-Wno-invalid-offsetof
+build:windows --cxxopt=-std:c++17 --host_cxxopt=-std:c++17

build:dbg --compilation_mode=dbg