Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
sumitsays committed Feb 26, 2024
2 parents 4b7df02 + a956893 commit ca03fdb
Show file tree
Hide file tree
Showing 61 changed files with 6,308 additions and 702 deletions.
6 changes: 2 additions & 4 deletions cmake/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1729,14 +1729,12 @@ if(onnxruntime_BUILD_KERNEL_EXPLORER)
endif()

# When GDK_PLATFORM is set then WINAPI_FAMILY is defined in gdk_toolchain.cmake (along with other relevant flags/definitions).
if (WIN32 AND NOT GDK_PLATFORM)
if (WIN32 AND NOT GDK_PLATFORM AND NOT CMAKE_CROSSCOMPILING)
if (NOT CMAKE_CXX_STANDARD_LIBRARIES MATCHES kernel32.lib)
# On onecore, link to the onecore build of the MSVC runtime
get_filename_component(msvc_path "${CMAKE_C_COMPILER}/../../../.." ABSOLUTE)
link_directories(BEFORE "${msvc_path}/lib/onecore/${onnxruntime_target_platform}")
# The .lib files in the MSVC runtime have a DEFAULITLIB entry for onecore.lib, which in turn links to reverse forwarders.
# We ignore that entry and use onecore_apiset.lib instead, since system components must not rely on reverse forwarders.
add_link_options("/NODEFAULTLIB:onecore.lib")
# The .lib files in the MSVC runtime have a DEFAULITLIB entry for onecore.lib, but it shold not cause any conflict with onecoreuap.lib
endif()
endif()

Expand Down
4 changes: 2 additions & 2 deletions cmake/wcos_rules_override.cmake
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
set(CMAKE_C_STANDARD_LIBRARIES_INIT onecoreuap_apiset.lib)
set(CMAKE_CXX_STANDARD_LIBRARIES_INIT onecoreuap_apiset.lib)
set(CMAKE_C_STANDARD_LIBRARIES_INIT onecoreuap.lib)
set(CMAKE_CXX_STANDARD_LIBRARIES_INIT onecoreuap.lib)
4 changes: 3 additions & 1 deletion js/web/lib/wasm/jsep/webgpu/ops/concat.ts
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,9 @@ const createConcatProgramInfo = (inputs: readonly TensorView[], axis: number): P

export const concat = (context: ComputeContext, attributes: ConcatAttributes): void => {
validateInputs(context.inputs);
context.compute(createConcatProgramInfo(context.inputs, attributes.axis));
// 0 length tensors are valid for concat, remove them
const nonEmptyInputs = context.inputs.filter(input => ShapeUtil.size(input.dims) > 0);
context.compute(createConcatProgramInfo(nonEmptyInputs, attributes.axis), {inputs: nonEmptyInputs});
};

export const parseConcatAttributes = (attributes: Record<string, unknown>): ConcatAttributes =>
Expand Down
2 changes: 1 addition & 1 deletion js/web/lib/wasm/jsep/webgpu/ops/gather.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ const createGatherProgramInfo = (inputs: readonly TensorView[], attributes: Gath
if (idx${x} < 0) {
idx${x} = idx${x} + uniforms.axisDimLimit;
}
var dataIndices${x} = ${data.type.indices}(0);
var dataIndices${x} : ${data.type.indices};
`;
for (let i = 0, j = 0; i < inputRank; i++) {
if (i === axis) {
Expand Down
22 changes: 0 additions & 22 deletions js/web/test/data/ops/add.jsonc
Original file line number Diff line number Diff line change
Expand Up @@ -157,28 +157,6 @@
"type": "float32"
}
]
},
{
"name": "T[2,0] T[2,1]",
"inputs": [
{
"data": [],
"dims": [2, 0],
"type": "float32"
},
{
"data": [1, 2],
"dims": [2, 1],
"type": "float32"
}
],
"outputs": [
{
"data": [],
"dims": [2, 0],
"type": "float32"
}
]
}
]
}
Expand Down
31 changes: 31 additions & 0 deletions js/web/test/data/ops/add_zero-sized.jsonc
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
[
{
"name": "Add with no attributes",
"operator": "Add",
"attributes": [],
"cases": [
{
"name": "T[2,0] T[2,1]",
"inputs": [
{
"data": [],
"dims": [2, 0],
"type": "float32"
},
{
"data": [1, 2],
"dims": [2, 1],
"type": "float32"
}
],
"outputs": [
{
"data": [],
"dims": [2, 0],
"type": "float32"
}
]
}
]
}
]
561 changes: 561 additions & 0 deletions js/web/test/data/ops/concat_zero-sized.jsonc

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions js/web/test/suite-test-list.jsonc
Original file line number Diff line number Diff line change
Expand Up @@ -1334,6 +1334,7 @@
"acos.jsonc",
"add.jsonc",
"add_int32.jsonc",
"add_zero-sized.jsonc",
//"and.jsonc",
"asin.jsonc",
"attention.jsonc",
Expand All @@ -1343,6 +1344,7 @@
"ceil.jsonc",
"concat.jsonc",
"concat_int32.jsonc",
"concat_zero-sized.jsonc",
"cast.jsonc",
"conv.jsonc",
"cos.jsonc",
Expand Down
7 changes: 7 additions & 0 deletions onnxruntime/core/optimizer/gemm_activation_fusion.cc
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,13 @@ Status GemmActivationFusion::ApplyImpl(Graph& graph, bool& modified, int graph_l
continue;
}

NodeArg* node_output = node.MutableOutputDefs()[0];
auto data_type = node_output->TypeAsProto()->tensor_type().elem_type();
if (data_type != ONNX_NAMESPACE::TensorProto_DataType_FLOAT) {
// FusedGemm is only registered for float data type in fused_gemm.cc!
continue;
}

const Node& next_node = *(node.OutputNodesBegin());
if (!IsFusableActivation(next_node) || next_node.GetExecutionProviderType() != node.GetExecutionProviderType()) {
continue;
Expand Down
4 changes: 2 additions & 2 deletions onnxruntime/core/platform/windows/env.cc
Original file line number Diff line number Diff line change
Expand Up @@ -459,8 +459,8 @@ Status WindowsEnv::MapFileIntoMemory(_In_z_ const ORTCHAR_T* file_path,

void* const mapped_base = MapViewOfFile(file_mapping_handle.get(),
FILE_MAP_READ,
0,
static_cast<DWORD>(mapped_offset),
static_cast<DWORD>((mapped_offset >> 32) & 0xFFFFFFFF),
static_cast<DWORD>(mapped_offset & 0xFFFFFFFF),
mapped_length);
GSL_SUPPRESS(r.11)
mapped_memory =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,15 +80,10 @@ namespace Windows::AI::MachineLearning::Adapter
};

// This is the counterpart to the MLOperatorGraphDesc ABI struct which owns its memory and uses containers.
// Either nodesAsOperatorDesc or nodesAsIDMLOperator can have non-zero size.
struct DmlGraphNodeCreateInfo
{
uint32_t nodeCount = 0;
std::vector<std::unique_ptr<AbstractOperatorDesc>> nodesAsOperatorDesc;

// TODO (jeffbloo): Remove this
std::vector<Microsoft::WRL::ComPtr<IDMLOperator>> nodesAsIDMLOperator;

std::vector<std::unique_ptr<AbstractOperatorDesc>> nodes;
std::vector<DML_INPUT_GRAPH_EDGE_DESC> inputEdges;
std::vector<DML_OUTPUT_GRAPH_EDGE_DESC> outputEdges;
std::vector<DML_INTERMEDIATE_GRAPH_EDGE_DESC> intermediateEdges;
Expand Down
Loading

0 comments on commit ca03fdb

Please sign in to comment.