Skip to content

Commit

Permalink
Merge branch 'adapters' into revert-1015-revert-1005-merge-some-main-…
Browse files Browse the repository at this point in the history
…changes-into-adapters
  • Loading branch information
omarahmed1111 committed Nov 8, 2023
2 parents b42649f + 612a263 commit 7ba8fec
Show file tree
Hide file tree
Showing 41 changed files with 1,115 additions and 400 deletions.
4 changes: 4 additions & 0 deletions .github/workflows/cmake.yml
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,10 @@ jobs:
run: LD_LIBRARY_PATH=${{github.workspace}}/dpcpp_compiler/lib
cmake --build ${{github.workspace}}/build -j $(nproc)

- name: Test adapter specific
working-directory: ${{github.workspace}}/build
run: ctest -C ${{matrix.build_type}} --output-on-failure -L "adapter-specific" --timeout 180

# Temporarily disabling platform test for L0, because of hang
# See issue: #824
- name: Test L0 adapter
Expand Down
2 changes: 1 addition & 1 deletion examples/codegen/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -43,5 +43,5 @@ if(LLVM_FOUND AND PkgConfig_FOUND AND LLVMSPIRVLib_FOUND)
)
endif()
else()
message(STATUS "The environment did not satisfy dependency requirements (LLVM, PkgConfig, LLVMSPIRVLib) for codegen example (skipping target).")
message(FATAL_ERROR "The environment did not satisfy dependency requirements (LLVM, PkgConfig, LLVMSPIRVLib) for codegen example (skipping target).")
endif()
21 changes: 21 additions & 0 deletions scripts/generate_code.py
Original file line number Diff line number Diff line change
Expand Up @@ -315,6 +315,25 @@ def _mako_info_hpp(path, namespace, tags, version, specs, meta):
specs=specs,
meta=meta)

"""
Entry-point:
generates linker version scripts
"""
def _mako_linker_scripts(path, ext, namespace, tags, version, specs, meta):
name = "adapter"
filename = f"{name}.{ext}.in"
fin = os.path.join(templates_dir, f"{filename}.mako")
fout = os.path.join(path, filename)
print("Generating %s..." % fout)
return util.makoWrite(
fin, fout,
name=name,
ver=version,
namespace=namespace,
tags=tags,
specs=specs,
meta=meta)

"""
Entry-point:
generates lib code
Expand Down Expand Up @@ -349,6 +368,8 @@ def generate_adapters(path, section, namespace, tags, version, specs, meta):

loc = 0
loc += _mako_null_adapter_cpp(dstpath, namespace, tags, version, specs, meta)
loc += _mako_linker_scripts(dstpath, "map", namespace, tags, version, specs, meta)
loc += _mako_linker_scripts(dstpath, "def", namespace, tags, version, specs, meta)
print("Generated %s lines of code.\n"%loc)

"""
Expand Down
11 changes: 11 additions & 0 deletions scripts/templates/adapter.def.in.mako
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<%!
import re
from templates import helper as th
%><%
n=namespace
%>\
LIBRARY @TARGET_LIBNAME@
EXPORTS
%for tbl in th.get_pfntables(specs, meta, n, tags):
${tbl['export']['name']}
%endfor
14 changes: 14 additions & 0 deletions scripts/templates/adapter.map.in.mako
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<%!
import re
from templates import helper as th
%><%
n=namespace
%>\
@TARGET_LIBNAME@ {
global:
%for tbl in th.get_pfntables(specs, meta, n, tags):
${tbl['export']['name']};
%endfor
local:
*;
};
6 changes: 3 additions & 3 deletions source/adapters/adapter.def.in
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
LIBRARY @TARGET_LIBNAME@
EXPORTS
urGetGlobalProcAddrTable
urGetBindlessImagesExpProcAddrTable
urGetCommandBufferExpProcAddrTable
urGetContextProcAddrTable
urGetDeviceProcAddrTable
urGetEnqueueProcAddrTable
urGetEventProcAddrTable
urGetGlobalProcAddrTable
urGetKernelProcAddrTable
urGetMemProcAddrTable
urGetPhysicalMemProcAddrTable
urGetPlatformProcAddrTable
urGetProgramProcAddrTable
urGetQueueProcAddrTable
urGetSamplerProcAddrTable
urGetUSMProcAddrTable
urGetUSMExpProcAddrTable
urGetUsmP2PExpProcAddrTable
urGetUSMProcAddrTable
urGetVirtualMemProcAddrTable
urGetDeviceProcAddrTable
6 changes: 3 additions & 3 deletions source/adapters/adapter.map.in
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
@TARGET_LIBNAME@ {
global:
urGetGlobalProcAddrTable;
urGetBindlessImagesExpProcAddrTable;
urGetCommandBufferExpProcAddrTable;
urGetContextProcAddrTable;
urGetDeviceProcAddrTable;
urGetEnqueueProcAddrTable;
urGetEventProcAddrTable;
urGetGlobalProcAddrTable;
urGetKernelProcAddrTable;
urGetMemProcAddrTable;
urGetPhysicalMemProcAddrTable;
urGetPlatformProcAddrTable;
urGetProgramProcAddrTable;
urGetQueueProcAddrTable;
urGetSamplerProcAddrTable;
urGetUSMProcAddrTable;
urGetUSMExpProcAddrTable;
urGetUsmP2PExpProcAddrTable;
urGetUSMProcAddrTable;
urGetVirtualMemProcAddrTable;
urGetDeviceProcAddrTable;
local:
*;
};
2 changes: 0 additions & 2 deletions source/adapters/cuda/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@
# See LICENSE.TXT
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception

set(CUDA_DIR "${CMAKE_CURRENT_SOURCE_DIR}" CACHE PATH "CUDA adapter directory")

set(TARGET_NAME ur_adapter_cuda)

add_ur_adapter(${TARGET_NAME}
Expand Down
Loading

0 comments on commit 7ba8fec

Please sign in to comment.