Skip to content
Navigation Menu
Sign in
Products
Platform
GitHub
Repository hosting, code review, and collaboration
Copilot
AI coding agent for tasks, projects, and automated work
Build & Ship
Actions
CI/CD and automation
Code Quality
Quality analysis, fixes, and enforcement
Codespaces
Cloud development environments
Secure
Code Security
Vulnerability detection and remediation
Secret Protection
Secret scanning and leak prevention
All Features
Developers
Learn
Documentation
Training
Certifications
Build
Build with Copilot
Customize Copilot
Integrations
Explore
Trending repos
GitHub Sponsors
Developer articles
Changelog
Changelog
Your source for the latest features, improvements, and fixes across GitHub products, all in one place.
Businesses
By Stage
Enterprises
Team
Startups
Nonprofits
By Industry
Healthcare
Financial services
Manufacturing
Government
See all industries
Evaluate GitHub
Why GitHub
Customer Stories
Business insights
Trust Center
Add-ons
GitHub Advanced Security
Enterprise-grade code security
Copilot for business
Enterprise-grade AI features
Premium Support
Enterprise-grade 24/7 support
Resources
Learn & Connect
Documentation
Resource center
Blog
Events & webinars
Community Forum
Customer Stories
Integrations
Support
Customer support
Training
GitHub Status
Company
About
Partners
Changelog
GitHub Universe
GitHub Universe
The event for developers, by developers — talks, workshops, and what’s next for GitHub.
Pricing
Search
/
Sign in
Sign up
Appearance settings
You signed in with another tab or window.
Reload
to refresh your session.
You signed out in another tab or window.
Reload
to refresh your session.
You switched accounts on another tab or window.
Reload
to refresh your session.
Dismiss alert
{{ message }}
Droid-VM
NativeMetal
Repository navigation
Code
Pull requests
Actions
Projects
Security and quality
Insights
More
items
Files
Expand file tree
main
Breadcrumbs
NativeMetal
/
OfflineMetalFunctionWire.h
Copy path
Blame
More file actions
Blame
More file actions
Latest commit
History
History
History
28 lines (28 loc) · 1.33 KB
main
Breadcrumbs
NativeMetal
/
OfflineMetalFunctionWire.h
Copy path
Top
File metadata and controls
Code
Blame
28 lines (28 loc) · 1.33 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
// SPDX-License-Identifier: MIT
// Bounded original function constants for explicit offline specialization.
#pragma once
#include "OfflineMetalWire.h"
enum { OFFLINE_METAL_MAX_CONSTANTS=16 };
typedef struct {uint64_t type,index,bytes,named;char name[128];uint8_t data[32];} OMFunctionConstant;
typedef struct {OMFunction function;uint64_t count;} OMSpecializedFunction;
static_assert(sizeof(OMFunctionConstant)==192 && sizeof(OMSpecializedFunction)==144,"Function constant wire ABI");
static_assert(sizeof(OMSpecializedFunction)+OFFLINE_METAL_MAX_CONSTANTS*sizeof(OMFunctionConstant)<=4080,"Bounded specialization transaction");
// Only qualified scalar and 2/4-component value sizes. Matrices, 3-component
// alignment profiles, aggregate and pointer types refuse explicitly.
static inline uint64_t OMFunctionConstantBytes(uint64_t type) {
switch(type) {
case 3:case 29:case 33:return 4; // float/int/uint
case 4:case 30:case 34:return 8;
case 6:case 32:case 36:return 16;
case 16:case 37:case 41:return 2; // half/short/ushort
case 17:case 38:case 42:return 4;
case 19:case 40:case 44:return 8;
case 45:case 49:case 53:return 1; // char/uchar/bool
case 46:case 50:case 54:return 2;
case 48:case 52:case 56:return 4;
case 81:case 85:return 8; // long/ulong
case 82:case 86:return 16;
case 84:case 88:return 32;
default:return 0;
}
}
You can’t perform that action at this time.