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

Snapdragon X processor is unsupported #21947

Open
agyonov opened this issue Sep 1, 2024 · 7 comments
Open

Snapdragon X processor is unsupported #21947

agyonov opened this issue Sep 1, 2024 · 7 comments
Labels
api:CSharp issues related to the C# API

Comments

@agyonov
Copy link

agyonov commented Sep 1, 2024

Describe the issue

When traying to run basic sample, form the Phi 3 Cookbook https://github.com/microsoft/Phi-3CookBook/blob/main/md/07.Labs/Csharp/src/LabsPhi301/Program.cs, I get an error:

Error in cpuinfo: Unknown chip model name 'Snapdragon(R) X Elite - X1E78100 - Qualcomm(R) Oryon(TM) CPU'.
Please add new Windows on Arm SoC/chip support to arm/windows/init.c!
unknown Qualcomm CPU part 0x1 ignored
unknown Qualcomm CPU part 0x1 ignored
unknown Qualcomm CPU part 0x1 ignored
unknown Qualcomm CPU part 0x1 ignored
unknown Qualcomm CPU part 0x1 ignored
unknown Qualcomm CPU part 0x1 ignored
unknown Qualcomm CPU part 0x1 ignored
unknown Qualcomm CPU part 0x1 ignored
unknown Qualcomm CPU part 0x1 ignored
unknown Qualcomm CPU part 0x1 ignored
unknown Qualcomm CPU part 0x1 ignored
unknown Qualcomm CPU part 0x1 ignored

To reproduce

Just try to run the cookbook sample on a Snapdragon X computer

Urgency

No response

Platform

Windows

OS Version

Windows 11 Pro

ONNX Runtime Installation

Released Package

ONNX Runtime Version or Commit ID

0.4.0

ONNX Runtime API

C#

Architecture

ARM64

Execution Provider

Default CPU

Execution Provider Library Version

No response

@github-actions github-actions bot added the api:CSharp issues related to the C# API label Sep 1, 2024
@agyonov
Copy link
Author

agyonov commented Sep 1, 2024

Actually the same error is displayed, when tried the 'Microsoft.ML.OnnxRuntimeGenAI.DirectML' package, with the Phi-3-vision-128k-instruct-onnx-directml. Thought the Snapdragon X Elit (Adreno 741) chips does support DirectX 12 and DirectML hardware requirements are fulfilled

@jywu-msft
Copy link
Member

jywu-msft commented Sep 17, 2024

@DavidLuong98
Copy link

DavidLuong98 commented Oct 4, 2024

@jywu-msft You mentioned it is a warning, I would have expected to see NPU usage spike up in the task manager when generating text with the model. Is there a way you can recommend us to verify if NPU is being used?

@agyonov
Copy link
Author

agyonov commented Oct 5, 2024

Hi @DavidLuong98,

As @jywu-msft, commented it is only a warning message, though annoying one. But, still the code/program works and through ONNX you can run interference on different models.

On your question, currently the only way I was able to make ONNX to use Snapdragon's NPU was by:

  1. Adding reference to Microsoft.ML.OnnxRuntime.QNN package
  2. Explicitly configuring the Qualcomm Execution provider:
// Create Session options
using var _sessionOptions = new SessionOptions();
Dictionary<string, string> config = new Dictionary<string, string> {
    { "backend_path", "QnnHtp.dll"},
    { "enable_htp_fp16_precision", "1"}
};
_sessionOptions.AppendExecutionProvider("QNN", config);
using var _encoderSession = new InferenceSession(fullModelFilePath, _sessionOptions);

BUT, this is done not for phi3 models, but other models available from Qualcomm AI Hub. Not for Generate ONNX API/Microsoft.ML.OnnxRuntimeGenAI, but for more "standard" one - Microsoft.ML.OnnxRuntime.

The DirectML ONNX package - Microsoft.ML.OnnxRuntime.DirectML, currently as per my experience, DOES NOT utilize the NPU, but DOES utilize the GPU - Snapdragon(R) X Elite - X1E78100 - Qualcomm(R) Adreno(TM) GPU. Despite the above mentioned warnings.

These are clearly seen by spikes in processors activity in the Task Manager's performance screen view.

I have not tested yet if the Generate API DirectML nuget package Microsoft.ML.OnnxRuntimeGenAI.DirectML, utilizes the GPU, as the "standard" API - Microsoft.ML.OnnxRuntime.DirectML does.

@jywu-msft
Copy link
Member

phi3 model is not yet supported out of box. it requires additional work to make it run reasonably well with an NPU. stay tuned.

@DavidLuong98
Copy link

@jywu-msft thanks for reply. Just curious and want to understand more. Are you saying that there's more work on Microsoft.ML.OnnxRuntime.DirectML side or more work for phi3 model to run on npu (implementing the npu operators). Just looking to see where the blockers are.

@ashumish-QCOM
Copy link

Hi

The warning message you’re encountering is due to the pytorch/cpuinfo library not yet recognizing the new Snapdragon X processor.

For now, you can continue using the Qualcomm Execution Provider by referencing the Microsoft.ML.OnnxRuntime.QNN package and configuring it appropriately. This setup has been effective for other models available from the Qualcomm AI Hub, although it may not be optimized for the Phi-3 models.

I hope this information is helpful, and I’ll keep an eye out for any updates regarding support for the Phi-3 models.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api:CSharp issues related to the C# API
Projects
None yet
Development

No branches or pull requests

4 participants