Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Integrate changes to WindowsAI to make ADO Build #2886

Merged
merged 9 commits into from
Jan 22, 2020
Merged
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
3 changes: 2 additions & 1 deletion cmake/onnx/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ target_include_directories(onnx_proto PUBLIC $<TARGET_PROPERTY:protobuf::libprot
target_compile_definitions(onnx_proto PUBLIC $<TARGET_PROPERTY:protobuf::libprotobuf,INTERFACE_COMPILE_DEFINITIONS>)
onnxruntime_protobuf_generate(APPEND_PATH IMPORT_DIRS ${ONNXRUNTIME_ROOT}/core/protobuf TARGET onnx_proto)
if (WIN32)
target_compile_options(onnx_proto PRIVATE "/wd4146" "/wd4125" "/wd4456" "/wd4267")
target_compile_options(onnx_proto PRIVATE "/wd4146" "/wd4125" "/wd4456" "/wd4267" "/wd4309")
else()
if(HAS_UNUSED_VARIABLE)
target_compile_options(onnx_proto PRIVATE "-Wno-unused-variable")
Expand Down Expand Up @@ -51,6 +51,7 @@ if (WIN32)
/wd4100 # 'param' : unreferenced formal parameter
/wd4244 # 'argument' conversion from 'google::protobuf::int64' to 'int', possible loss of data
/EHsc # exception handling - C++ may throw, extern "C" will not
/wd4996 # 'argument' Using double parameter version instead of single parameter version of SetTotalBytesLimit(). The second parameter is ignored.
)
set(onnx_static_library_flags
-IGNORE:4221 # LNK4221: This object file does not define any previously undefined public symbols, so it will not be used by any link operation that consumes this library
Expand Down
7 changes: 6 additions & 1 deletion cmake/winml.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,6 @@ target_include_directories(winml_adapter PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/win
target_include_directories(winml_adapter PRIVATE ${winml_lib_api_dir}) # needed for generated headers
target_include_directories(winml_adapter PRIVATE ${winml_lib_dir})
target_include_directories(winml_adapter PRIVATE ${winml_adapter_dir})
target_include_directories(winml_adapter PRIVATE ${winml_lib_common_dir}/inc)

set_target_properties(winml_adapter
PROPERTIES
Expand Down Expand Up @@ -386,11 +385,17 @@ target_compile_definitions(winml_lib_common PRIVATE
PLATFORM_WINDOWS
_SCL_SECURE_NO_WARNINGS)
add_dependencies(winml_lib_common winml_sdk_cppwinrt)
add_dependencies(winml_lib_common winml_api)
add_dependencies(winml_lib_common winml_api_native)
add_dependencies(winml_lib_common winml_api_native_internal)

target_include_directories(winml_lib_common PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/winml_api) # windows machine learning generated component headers
target_include_directories(winml_lib_common PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/winml_api/comp_generated) # windows machine learning generated component headers
target_include_directories(winml_lib_common PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/winml/sdk/cppwinrt/include) # sdk cppwinrt headers
target_include_directories(winml_lib_common PRIVATE ${winml_lib_api_dir})
target_include_directories(winml_lib_common PRIVATE ${CMAKE_CURRENT_BINARY_DIR})
target_include_directories(winml_lib_common PRIVATE ${winml_lib_common_dir}/inc)
target_precompiled_header(winml_lib_common inc/pch.h)

###########################
# Add winml_dll
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ class DmlOperatorPoolingTemplate : public DmlOperatorPooling
}
};

void QueryMaxPool(IMLOperatorSupportQueryContextPrivate* context, bool *isSupported)
void CALLBACK QueryMaxPool(IMLOperatorSupportQueryContextPrivate* context, bool *isSupported)
{
*isSupported = false;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ class DmlOperatorSliceTemplate : public DmlOperatorSlice
}
};

void QuerySlice(IMLOperatorSupportQueryContextPrivate* context, bool *isSupported)
void CALLBACK QuerySlice(IMLOperatorSupportQueryContextPrivate* context, bool *isSupported)
{
*isSupported = (context->GetInputCount() <= 4);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ interface IMLOperatorKernel;
class MLOperatorKernelCreationContext;

// Forward declares an external creation function.
#define DML_OP_EXTERN_CREATION_FUNCTION(operatorName) extern void Create##operatorName(IMLOperatorKernelCreationContext* kernelInfo, IMLOperatorKernel** opKernel)
#define DML_OP_EXTERN_QUERY_FUNCTION(operatorName) extern void Query##operatorName(IMLOperatorSupportQueryContextPrivate* context, bool *isSupported);
#define DML_OP_EXTERN_CREATION_FUNCTION(operatorName) extern void CALLBACK Create##operatorName(IMLOperatorKernelCreationContext* kernelInfo, IMLOperatorKernel** opKernel)
#define DML_OP_EXTERN_QUERY_FUNCTION(operatorName) extern void CALLBACK Query##operatorName(IMLOperatorSupportQueryContextPrivate* context, bool* isSupported);

// Declares a callback creation function of the given operator class.
// This does not register it, just declares it for usage by registration later.
Expand All @@ -20,7 +20,7 @@ class MLOperatorKernelCreationContext;
// commas in them break the macro, and so they are stuffed into the VA_ARGS.
//
#define DML_OP_DEFINE_CREATION_FUNCTION(operatorName, ...)\
extern void Create##operatorName(IMLOperatorKernelCreationContext* kernelInfo, IMLOperatorKernel** opKernel)\
extern void CALLBACK Create##operatorName(IMLOperatorKernelCreationContext* kernelInfo, IMLOperatorKernel** opKernel)\
{\
using T = __VA_ARGS__; \
THROW_IF_FAILED(MLOperatorKernel<T>::CreateInstance(*kernelInfo, /*out*/ opKernel));\
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -734,7 +734,7 @@ class MLOperatorKernel : public Microsoft::WRL::RuntimeClass<

using MLOperatorTypeInferenceFunction = void (CALLBACK*)(IMLOperatorTypeInferenceContext*);
using MLOperatorShapeInferenceFunction = void (CALLBACK*)(IMLOperatorShapeInferenceContext*);
using MLOperatorKernelCreateFn = void(*)(IMLOperatorKernelCreationContext*, IMLOperatorKernel**);
using MLOperatorKernelCreateFn = void(CALLBACK*)(IMLOperatorKernelCreationContext*, IMLOperatorKernel**);
using MLOperatorSupportQueryFunction = void (CALLBACK*)(IMLOperatorSupportQueryContextPrivate*, bool*);

class MLOperatorShapeInferrer : public Microsoft::WRL::RuntimeClass<
Expand Down
2 changes: 1 addition & 1 deletion winml/lib/Common/CommonDeviceHelpers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

// #include "dx.h"
// #include <D3dx12.h>

#include "inc/pch.h"
#if USE_DML
#include <DirectML.h>
#endif USE_DML
Expand Down
1 change: 0 additions & 1 deletion winml/lib/Common/inc/CommonDeviceHelpers.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@

#pragma once

#include "winrt_headers.h"
#include <dxgi1_6.h>
#include <initguid.h>
#include <d3d11.h>
Expand Down
1 change: 1 addition & 0 deletions winml/lib/Common/inc/pch.h
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
#include "winrt_headers.h"
4 changes: 2 additions & 2 deletions winml/test/scenario/cppwinrt/CustomOps.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -288,13 +288,13 @@ class FooKernel
};

template <bool VerifyTestAttributes = false>
void CreateABIFooKernel(IMLOperatorKernelCreationContext* kernelInfo, IMLOperatorKernel** opKernel)
void CALLBACK CreateABIFooKernel(IMLOperatorKernelCreationContext* kernelInfo, IMLOperatorKernel** opKernel)
{
HRESULT hr = MLOperatorKernel<FooKernel<float, VerifyTestAttributes>>::CreateInstance(*kernelInfo, opKernel);
THROW_IF_FAILED(hr);
}

void CreateTruncatedABIFooKernel(IMLOperatorKernelCreationContext* kernelInfo, IMLOperatorKernel** opKernel)
void CALLBACK CreateTruncatedABIFooKernel(IMLOperatorKernelCreationContext* kernelInfo, IMLOperatorKernel** opKernel)
{
HRESULT hr = MLOperatorKernel<FooKernel<float, true, true>>::CreateInstance(*kernelInfo, opKernel);
THROW_IF_FAILED(hr);
Expand Down