Apple Silicon

RSS for tag

Build apps, libraries, frameworks, plug-ins, and other executable code that run natively on Apple silicon.

Posts under Apple Silicon tag

200 Posts

Post

Replies

Boosts

Views

Activity

Cannot install Python from source on Apple Silicon M1
I am trying to install Python from source according to the readme using: ./configure make <-- Error happens here make test sudo make altinstall However, I cannot complete the make command since it fails with: Undefined symbols for architecture arm64: "_libintl_bindtextdomain", referenced from: __locale_bindtextdomain in _localemodule.o "_libintl_dcgettext", referenced from: __locale_dcgettext in _localemodule.o "_libintl_dgettext", referenced from: __locale_dgettext in _localemodule.o "_libintl_gettext", referenced from: __locale_gettext in _localemodule.o "_libintl_setlocale", referenced from: __locale_setlocale in _localemodule.o __locale_localeconv in _localemodule.o "_libintl_textdomain", referenced from: __locale_textdomain in _localemodule.o ld: symbol(s) not found for architecture arm64 clang: error: linker command failed with exit code 1 (use -v to see invocation) make: *** [Programs/_freeze_module] Error 1 Looks like make is somehow using the wrong architecture. I just don't know why. Does anyone have an idea?
2
0
1.3k
Sep ’23
Is it possible to develop apps for Vision Pro on an Intel Mac?
I just recently saw a message in the Unity forums, by a Unity staff member, that Apple requires an Apple Silicon based Mac (M1, M2) in order to build apps for the Vision Pro glasses. This confused me since the simulator works just fine on my Intel Mac. Is there any official statement from Apple on this? It would be weird to buy a new Mac just because of this.
1
0
2.5k
Aug ’23
Virtualize framework Connection Invalid when starting VM
Hi. Sorry if this question has been answered in another post, if it has I can't find it. My device is MacBook Pro 16-inch, M1, 2021. So I tried to create a VM using this guide from Apple I followed the guide and used an image of debian. Everything worked fine until the machine appeared stuck at some point of the installation. I chose my languages then I had some other prompt asking me to install something but I can't remember precisely the step at which I thought it was freezed (I think it was the GNOME install) So because the machine was not responding for several minutes (I might have been too hurried) I quitted the process by simply clicking on the Quit button in the VM window. The problem is that from that point onward, I can't load any VM anymore. The build is successful in Xcode, the machine starts but immediately quits with this response from Xcode logs : Virtual machine successfully started. Guest did stop virtual machine. 2023-02-02 22:22:45.413600+0100 GUILinux[22984:380971] [client] No error handler for XPC error: Connection invalid I just can't understand why, I tried to delete and download the guide again but it doesn't work. I will add that it's my first time using Xcode and I might have missed something obivous.
3
1
2k
Aug ’23
iOS app on MacOS M1 - Window Resize or Full Screen
MacOS M1 machines can run iOS applications. We have an iOS application that runs a fullscreen metal game. The game can also run across all desktop platforms via Steam. In additional to Steam, we would like to make it available through the AppStore on MacOS. We'd like to utilise our iOS builds for this so that the Apple payment (micro-transactions) and sign-in processes can be reused. While the app runs on MacOS, it runs in a small iPad shaped window that cannot be resized. We do not want to add iPad multitasking support (portrait orientation is not viable), but would like the window on MacOS to be expandable to full screen. Currently there is an option to make it full screen, but the metal view (MTKView) delegate does not receive a drawableSizeWillChange event for this, meaning the new resolution of the window cannot be received. Is there another method of retrieving a window size change event in this context? What is the recommended way of enabling window resizing on MacOS but not iPad for a single iOS app?
4
0
8.2k
Aug ’23
Unable to use bfloat on M1 Ultra
I have the higher end M1 Mac Studio, and I have had a lot of success with Metal pipelines. However, I tried to compile a compute pipeline that uses the bfloat type and it seems to have no idea what that is. Error: program_source:10:55: error: unknown type name 'bfloat'; did you mean 'float'? Is there an OS update that is necessary for this support?
1
0
733
Aug ’23
Error with GPU JIT function with GPU tensor UNIMPLEMENTED: DefaultDeviceAssignment not supported for Metal Client.
Hi everyone, I'm trying to test some functionality of jax-metal and got this error. Any help please? import jax import jax.numpy as jnp import numpy as np def f(x): y1=x+x*x+3 y2=x*x+x*x.T return y1*y2 x = np.random.randn(3000,3000).astype('float32') jax_x_gpu = jax.device_put(jnp.array(x), jax.devices('METAL')[0]) jax_x_cpu = jax.device_put(jnp.array(x), jax.devices('cpu')[0]) jax_f_gpu = jax.jit(f, backend='METAL') jax_f_gpu(jax_x_gpu) --------------------------------------------------------------------------- XlaRuntimeError Traceback (most recent call last) Cell In[1], line 17 13 jax_x_cpu = jax.device_put(jnp.array(x), jax.devices('cpu')[0]) 15 jax_f_gpu = jax.jit(f, backend='METAL') ---> 17 jax_f_gpu(jax_x_gpu) [... skipping hidden 5 frame] File ~/.virtualenvs/jax-metal/lib/python3.11/site-packages/jax/_src/pjit.py:817, in _create_sharding_with_device_backend(device, backend) 814 elif backend is not None: 815 assert device is None 816 out = SingleDeviceSharding( --> 817 xb.get_backend(backend).get_default_device_assignment(1)[0]) 818 return out XlaRuntimeError: UNIMPLEMENTED: DefaultDeviceAssignment not supported for Metal Client.
0
0
772
Aug ’23
OpenGL stutter on Apple Silicon
We use an in-house OpenGL app to provide the out-the-window visuals for our flight simulators. The app is cross platform, but until now the Mac version was only used by desktop researchers, not in our primary sim labs. Now we are attempting to replace some Windows boxes with Apple Studios. We can easily maintain high framerate, and visual quality is excellent, but we are finding the graphics have a bit of stutter during high yaw rates (which quickly forces new assets into view). I've eliminating unnecessary processes, tried raising my priority via pthread_set_qos_class_self_np() or thread_policy_set(), and reducing textures quality, all of which helped, but it didn't eliminate the problem. For background, we are using framebuffers, we have a very large texture database (90 GB), and the render code runs in the main thread (not a secondary thread). What might I be missing?
0
0
892
Aug ’23
Maximize memory read bandwidth on M1 Ultra/M2 Ultra
I am in the process of developing a matrix-vector multiplication kernel. While conducting performance evaluations, I've noticed that on M1/M1 Pro/M1 Max, the kernel demonstrates an impressive memory bandwidth utilization of around 90%. However, when executed on the M1 Ultra/M2 Ultra, this figure drops to approximately 65%. My suspicion is that this discrepancy is attributed to the dual-die architecture of the M1 Ultra/M2 Ultra. It's plausible that the necessary data might be stored within the L2 cache of the alternate die. Could you kindly provide any insights or recommendations for mitigating the occurrence of on-die L2 cache misses on the Ultra chips? Additionally, I would greatly appreciate any general advice aimed at enhancing memory load speeds on these particular chips.
0
0
967
Aug ’23
DeefaceLab: MacOs Gui port
I've been trying to get the bash/script version of DeepFaceLab to work with Apple Silicon Macs, but this was original a Windows project that even now has non-existent support for MacOs/Apple Silicon. I am thinking of converting everything into a native macOS app using Swift, specifically optimized for Apple Silicon GPUs. Here's what I got from ChatGPT. Any help/advice on how to do this would be greatly appreciated. I don't have any Swift programming experience, but I have experience with some coding and can generally figure things out. I know that this is probably not feasible for a single individual with little programming experience, but I wanted to throw this out there to see what others think. Thank you Here's a high-level overview of the steps involved in porting DeepFaceLab to Swift with a graphical UI: Understand DeepFaceLab: Thoroughly study the DeepFaceLab project, its Python scripts, and the overall architecture to grasp its functionalities and dependencies. Choose a Swift Framework: Decide on the UI framework you want to use for the macOS app. SwiftUI is Apple's latest UI framework that works across all Apple platforms, including macOS. Alternatively, you can use AppKit for a more traditional approach. Rewrite Python to Swift: Convert the Python code from DeepFaceLab into Swift. You'll need to rewrite all the image processing, deep learning, and video manipulation code in Swift, potentially using third-party Swift libraries or native macOS frameworks. Deep Learning Integration: Replace the Python-based deep learning library used in DeepFaceLab with an appropriate Swift-compatible deep learning framework. TensorFlow and PyTorch both offer Swift APIs, but you may need to adapt the specific model implementation to Swift. Image Processing: Find equivalent Swift libraries or frameworks for image processing tasks used in DeepFaceLab. UI Development: Design and implement the graphical user interface using SwiftUI or AppKit. You'll need to create views, controls, and navigation elements to interact with the underlying Swift code. Integration: Connect the Swift code with the UI components, ensuring that actions in the GUI trigger the appropriate Swift functions and display results back to the user. Testing and Debugging: Rigorously test the Swift application and debug any issues that arise during the porting process. Optimization: Ensure that the Swift app performs efficiently and effectively on macOS devices.
0
0
1k
Jul ’23
iOS Simulators not listed as Run Destinations (Xcode 14.3)
For all my iOS projects only simulators running iOS 16.4 are listed as Run Destinations ... although I've installed the iOS 13 simulator and corresponding entries are listed under "Devices & Simulators". I've toggled "Show run destination" from "Automatic" to "Always" with no avail. Deployment target is e.g. iOS 13, and I'm running Xcode Version 14.3 (14E222b) on a 14" MBP with Apple Silicon. As a current bypass I'm booting up the simulator manually and install apps by "xcrun simctl install booted APP.app" to allow some basic testing, but that's no sustainable solution. Any help is much appreciated! Mattes
7
5
19k
Jul ’23
Multi Thread Audio Unit plugin on apple silicon
I am developing a multi thread instrument plugin for audio unit V2. This topic is about a software synthesizer that has been proven to work on intel macs, and has been converted to apple silicon native. I have a problem when I use logic pro on apple silicon macs. Plug the created software synthesizer to the instrument track. Make the track not exist other than the track you created. Put it in recording mode. When the above steps are followed, the performance meter on the logic pro will show that the load is concentrated on one specific core and far exceeds the total load when the load is divided. This load occurs continuously and is resolved when another track is created and the track is selected. It is understandable as a specification that the load is concentrated on a particular core. However, the magnitude of the load is abnormal. In fact, when the peak exceeds 100%, it leads to the generation of acoustic noise. Also, in this case, the activity monitor included with macOS does not show any increase in the usage of a specific CPU core. Also, the time profiler included with XCode did not identify any location that took a large amount of time. We have examined various experimental programs and found that there is a positive correlation between the frequency of thread switches in multi threaded areas and the peak of this CPU spike. We even found a positive correlation between the frequency of thread switches in the multithreaded area and the peak of this CPU spike. Mutex is used for thread switch. In summary In summary, we speculate that performance seems to be worse when multi thread processing is done on a single core. Is there any solution to this problem at the developer level or at the customer level of logic pro? Symptom environment MacBookePro 16inch 2021 CPU: apple m1 max OS: macOS 12.6.3 Memory: 32GB Logic pro 10.7.9 Built-in speaker autido buffer size: 32 sample Performance meter before symptoms occurred A view of the performance meter with symptoms after the recording condition
0
0
822
Jul ’23
How can I test my native macOS app on an Intel-based hardware when I developed it on an Apple Silicon (M2 chip)?
I've written a native app for macOS on my MacBook Air (with the Apple M2 chip.) Now I need to test it for an Intel-based CPU. When I build my app in Xcode, it is supposed to cover both ARM64 and x86-64 architectures in a single Mach-O binary, but when I send it to my customer he tells me that the app works on the Apple silicon but it crashes on his Intel-based Mac. So I'm looking for ways to test-run my app on an Intel-based platform and see what is wrong there. (But I obviously don't want to buy a separate Mac just for that.) I know that one can use Azure to spin up a Windows, or a Linux VM and open it via a web browser. But it doesn't seem to support macOS. How can I run an Intel-based macOS in a virtual environment? Or, do you have any other suggestions?
3
0
2.0k
Jul ’23
Persisting data in a 'Designed for iPad' application
While working through a SwiftUI Tutorial, I found that using: FileManager.default.url(for:, in:, appropriateFor:, create:) to locate a directory for persisting some data, does not work on Apple Silicon Macs when building an app for the "My Mac (Designed for iPad)". Quitting the app loses all state saved. Both the iPhone and iPad test devices are able to save and restore state using this method as usual. Is this the expected behavior? I expected that the M1 platform would be capable of simulating a similar file system for the application. Targeting macOS, iOS, and iPadOS, what's the simplest method to acquire a valid "Documents" or "Data" directory to persist information across launches and after app updates? (Before going nuclear with CoreData, just hasn't been the most friendly API to work with in my experience so far)
2
0
1.2k
Jun ’23
Accessing Global Variables on Apple Silicon
I was helping a developer with a gnarly issue today and, as part of that, I had to explain how Apple silicon code accesses global variables. I’ve done this a few times now, so I figured I might as well write it up for all. If you have questions or comments, put them in a new thread and tag it with Debugging so that I see it. Share and Enjoy — Quinn “The Eskimo!” @ Developer Technical Support @ Apple let myEmail = "eskimo" + "1" + "@" + "apple.com" Accessing Global Variables on Apple Silicon Consider the -[WKWebView navigationDelegate getter method. The code for that is available in Darwin: 691 - (id <WKNavigationDelegate>)navigationDelegate 692 { 693 return _navigationState->navigationDelegate().autorelease(); 694 } This reads the _navigationState ivar, whose value is a C++ object pointer of type NavigationState, and calls the navigationDelegate() method on it. Finally, it calls the autorelease() method on the result. Disassembling this on Intel you see this: (lldb) disas -f WebKit`-[WKWebView navigationDelegate]: -> … <+0>: pushq %rbp … <+1>: movq %rsp, %rbp … <+4>: pushq %rbx … <+5>: pushq %rax … <+6>: movq 0x875bd2(%rip), %rax ; WKWebView._navigationState … <+13>: movq (%rdi,%rax), %rsi … <+17>: leaq -0x10(%rbp), %rbx … <+21>: movq %rbx, %rdi … <+24>: callq 0x10adce41c ; WebKit::NavigationState::navigationDelegate() … <+29>: movq (%rbx), %rdi … <+32>: callq 0x10b37398e ; symbol stub for: CFMakeCollectable … <+37>: movq %rax, %rdi … <+40>: callq 0x10b37ac0c ; symbol stub for: objc_autorelease … <+45>: addq $0x8, %rsp … <+49>: popq %rbx … <+50>: popq %rbp … <+51>: retq The code starting at +29 is the autorelease() stuff, so ignore that. Rather, focus on the code from +6 through to +24: At +6 it reads the WKWebView._navigationState global variable. The Objective-C runtime sets this up to be the offset from the start of the object to the _navigationState ivar. At +13 it reads the ivar itself. The remaining instructions set up the call to navigationDelegate(). The instruction at +6 is a PC-relative read (rip is the PC). This is well supported on 64-bit Intel [1], so it’s only one instruction. Now consider this same disassembly on Apple silicon: (lldb) disas -f WebKit`-[WKWebView navigationDelegate]: -> … <+0>: sub sp, sp, #0x20 … <+4>: stp x29, x30, [sp, #0x10] … <+8>: add x29, sp, #0x10 … <+12>: adrp x8, 2127 … <+16>: ldrsw x8, [x8, #0xc24] … <+20>: ldr x0, [x0, x8] … <+24>: add x8, sp, #0x8 … <+28>: bl 0x10523b620 ; WebKit::NavigationState::navigationDelegate() … <+32>: ldr x0, [sp, #0x8] … <+36>: bl 0x1057a9d8c ; symbol stub for: CFMakeCollectable … <+40>: bl 0x1057b8270 ; symbol stub for: objc_autorelease … <+44>: ldp x29, x30, [sp, #0x10] … <+48>: add sp, sp, #0x20 … <+52>: ret Again, the stuff from +32 onwards is uninteresting. The instructions of interest run from +12 to +28. Specifically, the two instructions at +12 and +16 represent a PC-relative read. This requires two instructions because Apple silicon instructions are of a fixed width. There’s not enough space in a 32-bit instruction to encode a large PC-relative offset. Rather, it has to be split across two instructions. The most interesting instruction is the one at +12, adrp. I’m not sure what this mnemonic is officially, but I always think of it as add relative to page. The instruction: Takes an immediate value Shifts it left by 12 bits Adds it to the PC Masks off the bottom 12-bits Puts that in the target register The instruction after the adrp can vary. In this case the goal is to load an int from a PC-relative address, so it’s a load instruction, ldrsw. This specific syntax uses an immediate offset from a base register. This offset ‘fills in’ the bits ‘missing’ in the address calculated by the preceding adrp instruction. Now, let’s say that the adrp instruction was at PC 0x1051665c4. Here’s how you calculate the value it generates: (lldb) p/x ((0x1051665c4+(2127<<12))&~0x0fff) (long) $10 = 0x00000001059b5000 Now add the immediate from the ldrsw to calculate the address used by that instruction: (lldb) p/a 0x00000001059b5000+0xc24 (long) $11 = 0x00000001059b5c24 WebKit`WKWebView._navigationState Finally, load an int value from that address: (lldb) p *(int *)0x00000001059b5c24 (int) $13 = 400 And so the value of the WKWebView._navigationState global variable, which is the offset of the _navigationState ivar within the WKWebView object, is 400. And on with the debugging! [1] Notably, it was very poorly supported on 32-bit Intel, but fortunately we don’t care about that any more.
0
0
699
Jun ’23
Pls fix m1 chip issues with external monitor hidpi
Can apple pls, pls, pls, tell me when can you fix the problem of m1 chip not support hidpi on external monitors? Or do you even aware of this problem? I've been using mac for a long time, and i was able to connect to a external monitor with high resolution and good size fonts using 3rd party softwares, like one-key-hidpi or rdm. However, now with your latest m1 chip, none of them work anymore. Now i can either use a high resolution with ant size fonts, or i can choose big font size with blurry displays resolution, which is very annoying. so, are we going to fix this issue? or is there any workaround for this?
128
20
96k
Jun ’23
Cannot install Python from source on Apple Silicon M1
I am trying to install Python from source according to the readme using: ./configure make <-- Error happens here make test sudo make altinstall However, I cannot complete the make command since it fails with: Undefined symbols for architecture arm64: "_libintl_bindtextdomain", referenced from: __locale_bindtextdomain in _localemodule.o "_libintl_dcgettext", referenced from: __locale_dcgettext in _localemodule.o "_libintl_dgettext", referenced from: __locale_dgettext in _localemodule.o "_libintl_gettext", referenced from: __locale_gettext in _localemodule.o "_libintl_setlocale", referenced from: __locale_setlocale in _localemodule.o __locale_localeconv in _localemodule.o "_libintl_textdomain", referenced from: __locale_textdomain in _localemodule.o ld: symbol(s) not found for architecture arm64 clang: error: linker command failed with exit code 1 (use -v to see invocation) make: *** [Programs/_freeze_module] Error 1 Looks like make is somehow using the wrong architecture. I just don't know why. Does anyone have an idea?
Replies
2
Boosts
0
Views
1.3k
Activity
Sep ’23
Is it possible to develop apps for Vision Pro on an Intel Mac?
I just recently saw a message in the Unity forums, by a Unity staff member, that Apple requires an Apple Silicon based Mac (M1, M2) in order to build apps for the Vision Pro glasses. This confused me since the simulator works just fine on my Intel Mac. Is there any official statement from Apple on this? It would be weird to buy a new Mac just because of this.
Replies
1
Boosts
0
Views
2.5k
Activity
Aug ’23
FCPR on Apple Silicon
Hi All, I would like to know if there are any C APIs to control the Floating-Point Control Register (FPCR) on Apple Silicon? The ARM documentation does not show any C APIs for doing this. The only example code looks like VHDL, so I was wondering if any developers here knew of any. Thanks
Replies
1
Boosts
0
Views
2.1k
Activity
Aug ’23
Virtualize framework Connection Invalid when starting VM
Hi. Sorry if this question has been answered in another post, if it has I can't find it. My device is MacBook Pro 16-inch, M1, 2021. So I tried to create a VM using this guide from Apple I followed the guide and used an image of debian. Everything worked fine until the machine appeared stuck at some point of the installation. I chose my languages then I had some other prompt asking me to install something but I can't remember precisely the step at which I thought it was freezed (I think it was the GNOME install) So because the machine was not responding for several minutes (I might have been too hurried) I quitted the process by simply clicking on the Quit button in the VM window. The problem is that from that point onward, I can't load any VM anymore. The build is successful in Xcode, the machine starts but immediately quits with this response from Xcode logs : Virtual machine successfully started. Guest did stop virtual machine. 2023-02-02 22:22:45.413600+0100 GUILinux[22984:380971] [client] No error handler for XPC error: Connection invalid I just can't understand why, I tried to delete and download the guide again but it doesn't work. I will add that it's my first time using Xcode and I might have missed something obivous.
Replies
3
Boosts
1
Views
2k
Activity
Aug ’23
How do I allow my iOS app to run in fullscreen on M1 Macs?
I know as of macOS 11.1 it is now possible to run your iOS/iPadOS apps in fullscreen on silicon Macs. Though I couldn't find anything online of how to do this. How would I go about making my app compatible?
Replies
4
Boosts
0
Views
3.5k
Activity
Aug ’23
iOS app on MacOS M1 - Window Resize or Full Screen
MacOS M1 machines can run iOS applications. We have an iOS application that runs a fullscreen metal game. The game can also run across all desktop platforms via Steam. In additional to Steam, we would like to make it available through the AppStore on MacOS. We'd like to utilise our iOS builds for this so that the Apple payment (micro-transactions) and sign-in processes can be reused. While the app runs on MacOS, it runs in a small iPad shaped window that cannot be resized. We do not want to add iPad multitasking support (portrait orientation is not viable), but would like the window on MacOS to be expandable to full screen. Currently there is an option to make it full screen, but the metal view (MTKView) delegate does not receive a drawableSizeWillChange event for this, meaning the new resolution of the window cannot be received. Is there another method of retrieving a window size change event in this context? What is the recommended way of enabling window resizing on MacOS but not iPad for a single iOS app?
Replies
4
Boosts
0
Views
8.2k
Activity
Aug ’23
Unable to use bfloat on M1 Ultra
I have the higher end M1 Mac Studio, and I have had a lot of success with Metal pipelines. However, I tried to compile a compute pipeline that uses the bfloat type and it seems to have no idea what that is. Error: program_source:10:55: error: unknown type name 'bfloat'; did you mean 'float'? Is there an OS update that is necessary for this support?
Replies
1
Boosts
0
Views
733
Activity
Aug ’23
Error with GPU JIT function with GPU tensor UNIMPLEMENTED: DefaultDeviceAssignment not supported for Metal Client.
Hi everyone, I'm trying to test some functionality of jax-metal and got this error. Any help please? import jax import jax.numpy as jnp import numpy as np def f(x): y1=x+x*x+3 y2=x*x+x*x.T return y1*y2 x = np.random.randn(3000,3000).astype('float32') jax_x_gpu = jax.device_put(jnp.array(x), jax.devices('METAL')[0]) jax_x_cpu = jax.device_put(jnp.array(x), jax.devices('cpu')[0]) jax_f_gpu = jax.jit(f, backend='METAL') jax_f_gpu(jax_x_gpu) --------------------------------------------------------------------------- XlaRuntimeError Traceback (most recent call last) Cell In[1], line 17 13 jax_x_cpu = jax.device_put(jnp.array(x), jax.devices('cpu')[0]) 15 jax_f_gpu = jax.jit(f, backend='METAL') ---> 17 jax_f_gpu(jax_x_gpu) [... skipping hidden 5 frame] File ~/.virtualenvs/jax-metal/lib/python3.11/site-packages/jax/_src/pjit.py:817, in _create_sharding_with_device_backend(device, backend) 814 elif backend is not None: 815 assert device is None 816 out = SingleDeviceSharding( --> 817 xb.get_backend(backend).get_default_device_assignment(1)[0]) 818 return out XlaRuntimeError: UNIMPLEMENTED: DefaultDeviceAssignment not supported for Metal Client.
Replies
0
Boosts
0
Views
772
Activity
Aug ’23
OpenGL stutter on Apple Silicon
We use an in-house OpenGL app to provide the out-the-window visuals for our flight simulators. The app is cross platform, but until now the Mac version was only used by desktop researchers, not in our primary sim labs. Now we are attempting to replace some Windows boxes with Apple Studios. We can easily maintain high framerate, and visual quality is excellent, but we are finding the graphics have a bit of stutter during high yaw rates (which quickly forces new assets into view). I've eliminating unnecessary processes, tried raising my priority via pthread_set_qos_class_self_np() or thread_policy_set(), and reducing textures quality, all of which helped, but it didn't eliminate the problem. For background, we are using framebuffers, we have a very large texture database (90 GB), and the render code runs in the main thread (not a secondary thread). What might I be missing?
Replies
0
Boosts
0
Views
892
Activity
Aug ’23
Maximize memory read bandwidth on M1 Ultra/M2 Ultra
I am in the process of developing a matrix-vector multiplication kernel. While conducting performance evaluations, I've noticed that on M1/M1 Pro/M1 Max, the kernel demonstrates an impressive memory bandwidth utilization of around 90%. However, when executed on the M1 Ultra/M2 Ultra, this figure drops to approximately 65%. My suspicion is that this discrepancy is attributed to the dual-die architecture of the M1 Ultra/M2 Ultra. It's plausible that the necessary data might be stored within the L2 cache of the alternate die. Could you kindly provide any insights or recommendations for mitigating the occurrence of on-die L2 cache misses on the Ultra chips? Additionally, I would greatly appreciate any general advice aimed at enhancing memory load speeds on these particular chips.
Replies
0
Boosts
0
Views
967
Activity
Aug ’23
DeefaceLab: MacOs Gui port
I've been trying to get the bash/script version of DeepFaceLab to work with Apple Silicon Macs, but this was original a Windows project that even now has non-existent support for MacOs/Apple Silicon. I am thinking of converting everything into a native macOS app using Swift, specifically optimized for Apple Silicon GPUs. Here's what I got from ChatGPT. Any help/advice on how to do this would be greatly appreciated. I don't have any Swift programming experience, but I have experience with some coding and can generally figure things out. I know that this is probably not feasible for a single individual with little programming experience, but I wanted to throw this out there to see what others think. Thank you Here's a high-level overview of the steps involved in porting DeepFaceLab to Swift with a graphical UI: Understand DeepFaceLab: Thoroughly study the DeepFaceLab project, its Python scripts, and the overall architecture to grasp its functionalities and dependencies. Choose a Swift Framework: Decide on the UI framework you want to use for the macOS app. SwiftUI is Apple's latest UI framework that works across all Apple platforms, including macOS. Alternatively, you can use AppKit for a more traditional approach. Rewrite Python to Swift: Convert the Python code from DeepFaceLab into Swift. You'll need to rewrite all the image processing, deep learning, and video manipulation code in Swift, potentially using third-party Swift libraries or native macOS frameworks. Deep Learning Integration: Replace the Python-based deep learning library used in DeepFaceLab with an appropriate Swift-compatible deep learning framework. TensorFlow and PyTorch both offer Swift APIs, but you may need to adapt the specific model implementation to Swift. Image Processing: Find equivalent Swift libraries or frameworks for image processing tasks used in DeepFaceLab. UI Development: Design and implement the graphical user interface using SwiftUI or AppKit. You'll need to create views, controls, and navigation elements to interact with the underlying Swift code. Integration: Connect the Swift code with the UI components, ensuring that actions in the GUI trigger the appropriate Swift functions and display results back to the user. Testing and Debugging: Rigorously test the Swift application and debug any issues that arise during the porting process. Optimization: Ensure that the Swift app performs efficiently and effectively on macOS devices.
Replies
0
Boosts
0
Views
1k
Activity
Jul ’23
iOS Simulators not listed as Run Destinations (Xcode 14.3)
For all my iOS projects only simulators running iOS 16.4 are listed as Run Destinations ... although I've installed the iOS 13 simulator and corresponding entries are listed under "Devices & Simulators". I've toggled "Show run destination" from "Automatic" to "Always" with no avail. Deployment target is e.g. iOS 13, and I'm running Xcode Version 14.3 (14E222b) on a 14" MBP with Apple Silicon. As a current bypass I'm booting up the simulator manually and install apps by "xcrun simctl install booted APP.app" to allow some basic testing, but that's no sustainable solution. Any help is much appreciated! Mattes
Replies
7
Boosts
5
Views
19k
Activity
Jul ’23
Multi Thread Audio Unit plugin on apple silicon
I am developing a multi thread instrument plugin for audio unit V2. This topic is about a software synthesizer that has been proven to work on intel macs, and has been converted to apple silicon native. I have a problem when I use logic pro on apple silicon macs. Plug the created software synthesizer to the instrument track. Make the track not exist other than the track you created. Put it in recording mode. When the above steps are followed, the performance meter on the logic pro will show that the load is concentrated on one specific core and far exceeds the total load when the load is divided. This load occurs continuously and is resolved when another track is created and the track is selected. It is understandable as a specification that the load is concentrated on a particular core. However, the magnitude of the load is abnormal. In fact, when the peak exceeds 100%, it leads to the generation of acoustic noise. Also, in this case, the activity monitor included with macOS does not show any increase in the usage of a specific CPU core. Also, the time profiler included with XCode did not identify any location that took a large amount of time. We have examined various experimental programs and found that there is a positive correlation between the frequency of thread switches in multi threaded areas and the peak of this CPU spike. We even found a positive correlation between the frequency of thread switches in the multithreaded area and the peak of this CPU spike. Mutex is used for thread switch. In summary In summary, we speculate that performance seems to be worse when multi thread processing is done on a single core. Is there any solution to this problem at the developer level or at the customer level of logic pro? Symptom environment MacBookePro 16inch 2021 CPU: apple m1 max OS: macOS 12.6.3 Memory: 32GB Logic pro 10.7.9 Built-in speaker autido buffer size: 32 sample Performance meter before symptoms occurred A view of the performance meter with symptoms after the recording condition
Replies
0
Boosts
0
Views
822
Activity
Jul ’23
Does VisionOS simulator(Designed for iPad) only support Apple Silicon?
It works fine on M1 Chip like the attach image, but could't select the Apple Vision Pro (Designed for iPad) on non-M1. Why VisionOS simulator(Designed for iPad) only support Apple Silicon?
Replies
0
Boosts
1
Views
793
Activity
Jul ’23
Validate Workspace in Xcode 14 build settings
Hi, I'm facing the issue for building the project for Simulator on M1 Mac. One of the suggested solutions was to enable Validate Workspace in project's Build Settings, but it seems it's not available in Xcode 14 anymore. Any suggestions?
Replies
2
Boosts
0
Views
2.7k
Activity
Jul ’23
How can I test my native macOS app on an Intel-based hardware when I developed it on an Apple Silicon (M2 chip)?
I've written a native app for macOS on my MacBook Air (with the Apple M2 chip.) Now I need to test it for an Intel-based CPU. When I build my app in Xcode, it is supposed to cover both ARM64 and x86-64 architectures in a single Mach-O binary, but when I send it to my customer he tells me that the app works on the Apple silicon but it crashes on his Intel-based Mac. So I'm looking for ways to test-run my app on an Intel-based platform and see what is wrong there. (But I obviously don't want to buy a separate Mac just for that.) I know that one can use Azure to spin up a Windows, or a Linux VM and open it via a web browser. But it doesn't seem to support macOS. How can I run an Intel-based macOS in a virtual environment? Or, do you have any other suggestions?
Replies
3
Boosts
0
Views
2.0k
Activity
Jul ’23
Persisting data in a 'Designed for iPad' application
While working through a SwiftUI Tutorial, I found that using: FileManager.default.url(for:, in:, appropriateFor:, create:) to locate a directory for persisting some data, does not work on Apple Silicon Macs when building an app for the "My Mac (Designed for iPad)". Quitting the app loses all state saved. Both the iPhone and iPad test devices are able to save and restore state using this method as usual. Is this the expected behavior? I expected that the M1 platform would be capable of simulating a similar file system for the application. Targeting macOS, iOS, and iPadOS, what's the simplest method to acquire a valid "Documents" or "Data" directory to persist information across launches and after app updates? (Before going nuclear with CoreData, just hasn't been the most friendly API to work with in my experience so far)
Replies
2
Boosts
0
Views
1.2k
Activity
Jun ’23
Better Optimization for games
In the video shown by Apple, there are two modes shown in the upper right corner: Composited and Direct. But I tried some games, such as Cyberpunk 2077 on Steam, they are all in the Composited mode. Is there a list of games that support the Direct mode?
Replies
1
Boosts
0
Views
1.3k
Activity
Jun ’23
Accessing Global Variables on Apple Silicon
I was helping a developer with a gnarly issue today and, as part of that, I had to explain how Apple silicon code accesses global variables. I’ve done this a few times now, so I figured I might as well write it up for all. If you have questions or comments, put them in a new thread and tag it with Debugging so that I see it. Share and Enjoy — Quinn “The Eskimo!” @ Developer Technical Support @ Apple let myEmail = "eskimo" + "1" + "@" + "apple.com" Accessing Global Variables on Apple Silicon Consider the -[WKWebView navigationDelegate getter method. The code for that is available in Darwin: 691 - (id <WKNavigationDelegate>)navigationDelegate 692 { 693 return _navigationState->navigationDelegate().autorelease(); 694 } This reads the _navigationState ivar, whose value is a C++ object pointer of type NavigationState, and calls the navigationDelegate() method on it. Finally, it calls the autorelease() method on the result. Disassembling this on Intel you see this: (lldb) disas -f WebKit`-[WKWebView navigationDelegate]: -> … <+0>: pushq %rbp … <+1>: movq %rsp, %rbp … <+4>: pushq %rbx … <+5>: pushq %rax … <+6>: movq 0x875bd2(%rip), %rax ; WKWebView._navigationState … <+13>: movq (%rdi,%rax), %rsi … <+17>: leaq -0x10(%rbp), %rbx … <+21>: movq %rbx, %rdi … <+24>: callq 0x10adce41c ; WebKit::NavigationState::navigationDelegate() … <+29>: movq (%rbx), %rdi … <+32>: callq 0x10b37398e ; symbol stub for: CFMakeCollectable … <+37>: movq %rax, %rdi … <+40>: callq 0x10b37ac0c ; symbol stub for: objc_autorelease … <+45>: addq $0x8, %rsp … <+49>: popq %rbx … <+50>: popq %rbp … <+51>: retq The code starting at +29 is the autorelease() stuff, so ignore that. Rather, focus on the code from +6 through to +24: At +6 it reads the WKWebView._navigationState global variable. The Objective-C runtime sets this up to be the offset from the start of the object to the _navigationState ivar. At +13 it reads the ivar itself. The remaining instructions set up the call to navigationDelegate(). The instruction at +6 is a PC-relative read (rip is the PC). This is well supported on 64-bit Intel [1], so it’s only one instruction. Now consider this same disassembly on Apple silicon: (lldb) disas -f WebKit`-[WKWebView navigationDelegate]: -> … <+0>: sub sp, sp, #0x20 … <+4>: stp x29, x30, [sp, #0x10] … <+8>: add x29, sp, #0x10 … <+12>: adrp x8, 2127 … <+16>: ldrsw x8, [x8, #0xc24] … <+20>: ldr x0, [x0, x8] … <+24>: add x8, sp, #0x8 … <+28>: bl 0x10523b620 ; WebKit::NavigationState::navigationDelegate() … <+32>: ldr x0, [sp, #0x8] … <+36>: bl 0x1057a9d8c ; symbol stub for: CFMakeCollectable … <+40>: bl 0x1057b8270 ; symbol stub for: objc_autorelease … <+44>: ldp x29, x30, [sp, #0x10] … <+48>: add sp, sp, #0x20 … <+52>: ret Again, the stuff from +32 onwards is uninteresting. The instructions of interest run from +12 to +28. Specifically, the two instructions at +12 and +16 represent a PC-relative read. This requires two instructions because Apple silicon instructions are of a fixed width. There’s not enough space in a 32-bit instruction to encode a large PC-relative offset. Rather, it has to be split across two instructions. The most interesting instruction is the one at +12, adrp. I’m not sure what this mnemonic is officially, but I always think of it as add relative to page. The instruction: Takes an immediate value Shifts it left by 12 bits Adds it to the PC Masks off the bottom 12-bits Puts that in the target register The instruction after the adrp can vary. In this case the goal is to load an int from a PC-relative address, so it’s a load instruction, ldrsw. This specific syntax uses an immediate offset from a base register. This offset ‘fills in’ the bits ‘missing’ in the address calculated by the preceding adrp instruction. Now, let’s say that the adrp instruction was at PC 0x1051665c4. Here’s how you calculate the value it generates: (lldb) p/x ((0x1051665c4+(2127<<12))&~0x0fff) (long) $10 = 0x00000001059b5000 Now add the immediate from the ldrsw to calculate the address used by that instruction: (lldb) p/a 0x00000001059b5000+0xc24 (long) $11 = 0x00000001059b5c24 WebKit`WKWebView._navigationState Finally, load an int value from that address: (lldb) p *(int *)0x00000001059b5c24 (int) $13 = 400 And so the value of the WKWebView._navigationState global variable, which is the offset of the _navigationState ivar within the WKWebView object, is 400. And on with the debugging! [1] Notably, it was very poorly supported on 32-bit Intel, but fortunately we don’t care about that any more.
Replies
0
Boosts
0
Views
699
Activity
Jun ’23
Pls fix m1 chip issues with external monitor hidpi
Can apple pls, pls, pls, tell me when can you fix the problem of m1 chip not support hidpi on external monitors? Or do you even aware of this problem? I've been using mac for a long time, and i was able to connect to a external monitor with high resolution and good size fonts using 3rd party softwares, like one-key-hidpi or rdm. However, now with your latest m1 chip, none of them work anymore. Now i can either use a high resolution with ant size fonts, or i can choose big font size with blurry displays resolution, which is very annoying. so, are we going to fix this issue? or is there any workaround for this?
Replies
128
Boosts
20
Views
96k
Activity
Jun ’23