Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adding a skeleton for a HAL backend for JITing serialized LLVMIR exec…
…utables. PiperOrigin-RevId: 293898800
- Loading branch information
1 parent
7f59964
commit d9b2a23
Showing
15 changed files
with
921 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,108 @@ | ||
# Copyright 2020 Google LLC | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# https://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
|
||
# HAL implementation for jitting CPU code from LLVMIR. | ||
|
||
package( | ||
default_visibility = ["//visibility:public"], | ||
licenses = ["notice"], # Apache 2.0 | ||
) | ||
|
||
cc_library( | ||
name = "llvmjit_executable", | ||
srcs = ["llvmjit_executable.cc"], | ||
hdrs = ["llvmjit_executable.h"], | ||
deps = [ | ||
"//iree/base:status", | ||
"//iree/hal:allocator", | ||
"//iree/hal:executable", | ||
"//iree/hal:executable_spec", | ||
"@com_google_absl//absl/types:span", | ||
], | ||
) | ||
|
||
cc_library( | ||
name = "llvmjit_command_processor", | ||
srcs = ["llvmjit_command_processor.cc"], | ||
hdrs = ["llvmjit_command_processor.h"], | ||
deps = [ | ||
":llvmjit_executable", | ||
"//iree/base:tracing", | ||
"//iree/hal/host:host_local_command_processor", | ||
], | ||
) | ||
|
||
cc_library( | ||
name = "llvmjit_executable_cache", | ||
srcs = ["llvmjit_executable_cache.cc"], | ||
hdrs = ["llvmjit_executable_cache.h"], | ||
deps = [ | ||
":llvmjit_executable", | ||
"//iree/base:source_location", | ||
"//iree/base:status", | ||
"//iree/base:tracing", | ||
"//iree/hal:allocator", | ||
"//iree/hal:executable", | ||
"//iree/hal:executable_cache", | ||
"//iree/hal:executable_format", | ||
], | ||
) | ||
|
||
cc_library( | ||
name = "llvmjit_device", | ||
srcs = ["llvmjit_device.cc"], | ||
hdrs = ["llvmjit_device.h"], | ||
deps = [ | ||
":llvmjit_command_processor", | ||
":llvmjit_executable_cache", | ||
"//iree/base:memory", | ||
"//iree/base:status", | ||
"//iree/base:tracing", | ||
"//iree/hal:command_buffer_validation", | ||
"//iree/hal:command_queue", | ||
"//iree/hal:device", | ||
"//iree/hal:fence", | ||
"//iree/hal/host:async_command_queue", | ||
"//iree/hal/host:host_event", | ||
"//iree/hal/host:host_local_allocator", | ||
"//iree/hal/host:host_submission_queue", | ||
"//iree/hal/host:inproc_command_buffer", | ||
"@com_google_absl//absl/container:inlined_vector", | ||
"@com_google_absl//absl/memory", | ||
"@com_google_absl//absl/types:span", | ||
], | ||
) | ||
|
||
cc_library( | ||
name = "llvmjit_driver", | ||
srcs = ["llvmjit_driver.cc"], | ||
hdrs = ["llvmjit_driver.h"], | ||
deps = [ | ||
":llvmjit_device", | ||
"//iree/hal:device_info", | ||
"//iree/hal:driver", | ||
], | ||
) | ||
|
||
cc_library( | ||
name = "llvmjit_driver_module", | ||
srcs = ["llvmjit_driver_module.cc"], | ||
deps = [ | ||
":llvmjit_driver", | ||
"//iree/base:init", | ||
"//iree/base:status", | ||
"//iree/hal:driver_registry", | ||
], | ||
alwayslink = 1, | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,158 @@ | ||
# Copyright 2020 Google LLC | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# https://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
|
||
iree_cc_library( | ||
NAME | ||
llvmjit_executable_cache | ||
HDRS | ||
"llvmjit_executable_cache.h" | ||
SRCS | ||
"llvmjit_executable_cache.cc" | ||
DEPS | ||
::llvmjit_executable | ||
iree::base::source_location | ||
iree::base::status | ||
iree::base::tracing | ||
iree::hal::allocator | ||
iree::hal::executable | ||
iree::hal::executable_cache | ||
iree::hal::executable_format | ||
iree::vm::instance | ||
iree::vm::module | ||
PUBLIC | ||
) | ||
|
||
iree_cc_library( | ||
NAME | ||
llvmjit_command_processor | ||
HDRS | ||
"llvmjit_command_processor.h" | ||
SRCS | ||
"llvmjit_command_processor.cc" | ||
DEPS | ||
::llvmjit_executable | ||
iree::base::api_util | ||
iree::base::status | ||
iree::base::tracing | ||
iree::hal::host::host_local_command_processor | ||
iree::vm::invocation | ||
iree::vm::variant_list | ||
PUBLIC | ||
) | ||
|
||
iree_cc_library( | ||
NAME | ||
llvmjit_device | ||
HDRS | ||
"llvmjit_device.h" | ||
SRCS | ||
"llvmjit_device.cc" | ||
DEPS | ||
::llvmjit_executable_cache | ||
::llvmjit_command_processor | ||
iree::base::memory | ||
iree::base::status | ||
iree::base::tracing | ||
iree::hal::command_buffer_validation | ||
iree::hal::command_queue | ||
iree::hal::device | ||
iree::hal::fence | ||
iree::hal::host::async_command_queue | ||
iree::hal::host::host_event | ||
iree::hal::host::host_local_allocator | ||
iree::hal::host::host_submission_queue | ||
iree::hal::host::inproc_command_buffer | ||
iree::vm::instance | ||
iree::vm::module | ||
absl::inlined_vector | ||
absl::memory | ||
absl::span | ||
PUBLIC | ||
) | ||
|
||
iree_cc_library( | ||
NAME | ||
llvmjit_driver | ||
HDRS | ||
"llvmjit_driver.h" | ||
SRCS | ||
"llvmjit_driver.cc" | ||
DEPS | ||
::llvmjit_device | ||
::llvmjit_module | ||
iree::base::api_util | ||
iree::base::tracing | ||
iree::hal::device_info | ||
iree::hal::driver | ||
iree::vm::instance | ||
iree::vm::module | ||
PUBLIC | ||
) | ||
|
||
iree_cc_library( | ||
NAME | ||
llvmjit_driver_module | ||
SRCS | ||
"llvmjit_driver_module.cc" | ||
DEPS | ||
::llvmjit_driver | ||
iree::base::init | ||
iree::base::status | ||
iree::hal::driver_registry | ||
ALWAYSLINK | ||
PUBLIC | ||
) | ||
|
||
iree_cc_library( | ||
NAME | ||
llvmjit_executable | ||
HDRS | ||
"llvmjit_executable.h" | ||
SRCS | ||
"llvmjit_executable.cc" | ||
DEPS | ||
iree::base::api_util | ||
iree::base::status | ||
iree::base::tracing | ||
iree::hal::allocator | ||
iree::hal::executable | ||
iree::hal::executable_spec | ||
iree::vm::bytecode_module | ||
iree::vm::context | ||
iree::vm::instance | ||
iree::vm::module | ||
absl::inlined_vector | ||
absl::span | ||
PUBLIC | ||
) | ||
|
||
iree_cc_library( | ||
NAME | ||
llvmjit_module | ||
HDRS | ||
"llvmjit_module.h" | ||
SRCS | ||
"llvmjit_module.cc" | ||
DEPS | ||
::op_kernels | ||
iree::base::api | ||
iree::base::memory | ||
iree::base::ref_ptr | ||
iree::base::tracing | ||
iree::vm | ||
iree::vm::module_abi_cc | ||
iree::vm::types | ||
absl::span | ||
PUBLIC | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
// Copyright 2020 Google LLC | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// https://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
// | ||
#include "iree/hal/llvmjit/llvmjit_command_processor.h" | ||
|
||
#include "iree/base/tracing.h" | ||
#include "iree/hal/llvmjit/llvmjit_executable.h" | ||
|
||
namespace iree { | ||
namespace hal { | ||
namespace llvmjit { | ||
|
||
LLVMJITCommandProcessor::LLVMJITCommandProcessor( | ||
Allocator* allocator, CommandBufferModeBitfield mode, | ||
CommandCategoryBitfield command_categories) | ||
: HostLocalCommandProcessor(allocator, mode, command_categories) {} | ||
|
||
LLVMJITCommandProcessor::~LLVMJITCommandProcessor() = default; | ||
|
||
Status LLVMJITCommandProcessor::Dispatch( | ||
const DispatchRequest& dispatch_request) { | ||
IREE_TRACE_SCOPE0("LLVMJITCommandProcessor::Dispatch"); | ||
return OkStatus(); | ||
} | ||
} // namespace llvmjit | ||
} // namespace hal | ||
} // namespace iree |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
// Copyright 2020 Google LLC | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// https://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
// | ||
#ifndef IREE_HAL_LLVMJIT_LLVMJIT_COMMAND_PROCESSOR_H_ | ||
#define IREE_HAL_LLVMJIT_LLVMJIT_COMMAND_PROCESSOR_H_ | ||
#include "iree/hal/host/host_local_command_processor.h" | ||
|
||
namespace iree { | ||
namespace hal { | ||
namespace llvmjit { | ||
|
||
class LLVMJITCommandProcessor final : public HostLocalCommandProcessor { | ||
public: | ||
LLVMJITCommandProcessor(Allocator* allocator, CommandBufferModeBitfield mode, | ||
CommandCategoryBitfield command_categories); | ||
~LLVMJITCommandProcessor() override; | ||
|
||
Status Dispatch(const DispatchRequest& dispatch_request) override; | ||
}; | ||
} // namespace llvmjit | ||
} // namespace hal | ||
} // namespace iree | ||
|
||
#endif // IREE_HAL_LLVMJIT_LLVMJIT_COMMAND_PROCESSOR_H_ |
Oops, something went wrong.