Skip to content

Commit 51e5262

Browse files
Merge branch 'main' into toupstream/linear_int16
2 parents 1656504 + b87ef5d commit 51e5262

36 files changed

+419
-101
lines changed

.ci/scripts/setup-windows-msvc.ps1

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
conda create --yes --quiet -n et python=3.12
2+
conda activate et
3+
4+
# Install cmake
5+
conda install -y cmake
6+
7+
# Activate the VS environment - this is required for MSVC to work
8+
# There are a bunch of environment variables that it requires.
9+
# See https://learn.microsoft.com/en-us/cpp/build/building-on-the-command-line.
10+
& "C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\Common7\Tools\Launch-VsDevShell.ps1" -Arch amd64
11+
12+
# Install CI requirements
13+
pip install -r .ci/docker/requirements-ci.txt
14+
15+
# Create build directory
16+
$buildDir = "cmake-out-msvc"
17+
if (Test-Path -Path $buildDir) {
18+
Remove-Item -Path $buildDir -Recurse -Force
19+
}
20+
New-Item -Path $buildDir -ItemType Directory
21+
22+
# Configure CMake with MSVC (not ClangCL) and disable custom/quantized ops
23+
cmake -S . -B $buildDir `
24+
-DCMAKE_BUILD_TYPE=Release `
25+
-DEXECUTORCH_BUILD_EXECUTOR_RUNNER=ON `
26+
-DEXECUTORCH_BUILD_EXTENSION_DATA_LOADER=ON `
27+
-DEXECUTORCH_BUILD_EXTENSION_MODULE=ON `
28+
-DEXECUTORCH_BUILD_EXTENSION_TENSOR=ON `
29+
-DEXECUTORCH_BUILD_EXTENSION_FLAT_TENSOR=ON `
30+
-DEXECUTORCH_BUILD_EXTENSION_NAMED_DATA_MAP=ON `
31+
-DEXECUTORCH_BUILD_KERNELS_OPTIMIZED=ON `
32+
-DEXECUTORCH_BUILD_KERNELS_CUSTOM=OFF `
33+
-DEXECUTORCH_BUILD_KERNELS_CUSTOM_AOT=OFF `
34+
-DEXECUTORCH_BUILD_KERNELS_QUANTIZED=OFF `
35+
-DEXECUTORCH_BUILD_XNNPACK=ON `
36+
-DEXECUTORCH_BUILD_EXTENSION_LLM=ON `
37+
-DEXECUTORCH_BUILD_EXTENSION_LLM_RUNNER=ON
38+
39+
if ($LASTEXITCODE -ne 0) {
40+
Write-Host "CMake configuration failed. Exit code: $LASTEXITCODE."
41+
exit $LASTEXITCODE
42+
}
43+
44+
# Build with MSVC
45+
cmake --build $buildDir --config Release -j16
46+
47+
if ($LASTEXITCODE -ne 0) {
48+
Write-Host "Build failed. Exit code: $LASTEXITCODE."
49+
exit $LASTEXITCODE
50+
}
51+
52+
Write-Host "MSVC build completed successfully!"

.github/workflows/windows-msvc.yml

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
name: Windows MSVC Build
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
- release/*
8+
tags:
9+
- ciflow/trunk/*
10+
pull_request:
11+
paths:
12+
- .ci/docker/ci_commit_pins/pytorch.txt
13+
- .ci/scripts/**
14+
workflow_dispatch:
15+
16+
concurrency:
17+
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }}-${{ github.event_name == 'workflow_dispatch' }}-${{ github.event_name == 'schedule' }}
18+
cancel-in-progress: true
19+
20+
jobs:
21+
build-windows-msvc:
22+
name: build-windows-msvc
23+
uses: pytorch/test-infra/.github/workflows/windows_job.yml@main
24+
with:
25+
submodules: 'recursive'
26+
ref: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.sha || github.sha }}
27+
timeout: 60
28+
script: |
29+
conda init powershell
30+
powershell -Command "& {
31+
Set-PSDebug -Trace 1
32+
\$ErrorActionPreference = 'Stop'
33+
\$PSNativeCommandUseErrorActionPreference = \$true
34+
.ci/scripts/setup-windows-msvc.ps1
35+
}"
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
/*
2+
* Copyright (c) Meta Platforms, Inc. and affiliates.
3+
* All rights reserved.
4+
*
5+
* This source code is licensed under the BSD-style license found in the
6+
* LICENSE file in the root directory of this source tree.
7+
*/
8+
9+
#pragma once
10+
11+
#include <executorch/runtime/core/exec_aten/util/tensor_util.h>
12+
13+
#define XT_KERNEL_CHECK(ctx, out, kernel, ...) \
14+
{ \
15+
const auto ret = kernel(__VA_ARGS__); \
16+
ET_KERNEL_CHECK_MSG( \
17+
ctx, \
18+
ret == 0, \
19+
InvalidArgument, \
20+
out, \
21+
"Failed to run kernel: " #kernel "(" #__VA_ARGS__ ")"); \
22+
}

backends/cadence/fusion_g3/operators/op_add.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
#include <xa_nnlib_kernels_api.h>
1212

13-
#include <executorch/backends/cadence/fusion_g3/operators/xt_macros.h>
13+
#include <executorch/backends/cadence/common/xt_macros.h>
1414
#include <executorch/kernels/portable/cpu/scalar_utils.h>
1515
#include <executorch/kernels/portable/cpu/util/elementwise_util.h>
1616
#include <executorch/kernels/portable/cpu/util/kernel_ops_util.h>

backends/cadence/fusion_g3/operators/op_cat.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313

1414
#include <xa_nnlib_kernels_api.h>
1515

16-
#include <executorch/backends/cadence/fusion_g3/operators/xt_macros.h>
16+
#include <executorch/backends/cadence/common/xt_macros.h>
1717
#include <executorch/kernels/portable/cpu/util/copy_ops_util.h>
1818
#include <executorch/runtime/kernel/kernel_includes.h>
1919

backends/cadence/fusion_g3/operators/op_clamp.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515

1616
#include <xa_nnlib_kernels_api.h>
1717

18-
#include <executorch/backends/cadence/fusion_g3/operators/xt_macros.h>
18+
#include <executorch/backends/cadence/common/xt_macros.h>
1919
#include <executorch/kernels/portable/cpu/scalar_utils.h>
2020
#include <executorch/kernels/portable/cpu/util/elementwise_util.h>
2121
#include <executorch/kernels/portable/cpu/util/math_util.h>

backends/cadence/fusion_g3/operators/op_dequantize.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414

1515
#include <xa_nnlib_kernels_api.h>
1616

17-
#include <executorch/backends/cadence/fusion_g3/operators/xt_macros.h>
17+
#include <executorch/backends/cadence/common/xt_macros.h>
1818
#include <executorch/kernels/portable/cpu/util/reduce_util.h>
1919
#include <executorch/runtime/kernel/kernel_includes.h>
2020

backends/cadence/fusion_g3/operators/op_div.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212

1313
#include <xa_nnlib_kernels_api.h>
1414

15-
#include <executorch/backends/cadence/fusion_g3/operators/xt_macros.h>
15+
#include <executorch/backends/cadence/common/xt_macros.h>
1616
#include <executorch/kernels/portable/cpu/scalar_utils.h>
1717
#include <executorch/kernels/portable/cpu/util/elementwise_util.h>
1818
#include <executorch/kernels/portable/cpu/util/math_util.h>

backends/cadence/fusion_g3/operators/op_exp.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212

1313
#include <xa_nnlib_kernels_api.h>
1414

15-
#include <executorch/backends/cadence/fusion_g3/operators/xt_macros.h>
15+
#include <executorch/backends/cadence/common/xt_macros.h>
1616
#include <executorch/kernels/portable/cpu/pattern/pattern.h>
1717
#include <executorch/runtime/kernel/kernel_includes.h>
1818

backends/cadence/fusion_g3/operators/op_hardtanh.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111

1212
#include <xa_nnlib_kernels_api.h>
1313

14-
#include <executorch/backends/cadence/fusion_g3/operators/xt_macros.h>
14+
#include <executorch/backends/cadence/common/xt_macros.h>
1515
#include <executorch/kernels/portable/cpu/scalar_utils.h>
1616
#include <executorch/kernels/portable/cpu/util/functional_util.h>
1717
#include <executorch/kernels/portable/cpu/util/math_util.h>

0 commit comments

Comments
 (0)