[Mac] Update cocoa for mac os 15#13
Conversation
| #include <objc/objc.h> | ||
| #include <objc/runtime.h> | ||
|
|
||
| typedef const struct __CFAttributedString *CFAttributedStringRef; |
There was a problem hiding this comment.
Is this typedef required by the included header file below? Is there a better way to do this? Like making this typedef part of the included header file?
There was a problem hiding this comment.
These headers are all system headers, from OS X:
#include <ApplicationServices/ApplicationServices.h>
#include <CoreGraphics/CGBase.h>
#include <CoreGraphics/CGGeometry.h>
#include <AppKit/AppKit.h>
This is mine, that I create in this PR, but is dedicated to keycodes:
#include "taichi/ui/gui/cocoa_keycodes.h"
It is an interesting quesiton however, why we need this random spurious define 🤔
There was a problem hiding this comment.
I asked copilot, and it claims i should use:
#include <CoreFoundation/CFAttributedString.h>
Not sure if that is hallucinated though 🤔 I guess I can try the build 🤔
There was a problem hiding this comment.
Yeah, that hreader from copilot totally didnt work for me:
In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX15.5.sdk/System/Library/Frameworks/CoreText.framework/Headers/CoreText.h:26:
/Library/Developer/CommandLineTools/SDKs/MacOSX15.5.sdk/System/Library/Frameworks/CoreText.framework/Headers/CTFramesetter.h:85:5: error: unknown type name 'CFAttributedStringRef'; did you mean 'NSAttributedStringKey'?
CFAttributedStringRef attrString ) CT_AVAILABLE(macos(10.5), ios(3.2), watchos(2.0), tvos(9.0));
^
/Library/Developer/CommandLineTools/SDKs/MacOSX15.5.sdk/System/Library/Frameworks/Foundation.framework/Headers/NSAttributedString.h:22:20: note: 'NSAttributedStringKey' declared here
typedef NSString * NSAttributedStringKey NS_TYPED_EXTENSIBLE_ENUM;
^
In file included from /Users/hugh/git/taichi/taichi/rhi/metal/metal_device.mm:1:
In file included from /Users/hugh/git/taichi/taichi/rhi/metal/metal_device.h:14:
In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX15.5.sdk/System/Library/Frameworks/MetalKit.framework/Headers/MetalKit.h:8:
In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX15.5.sdk/System/Library/Frameworks/MetalKit.framework/Headers/MTKView.h:11:
In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX15.5.sdk/System/Library/Frameworks/AppKit.framework/Headers/AppKit.h:28:
In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX15.5.sdk/System/Library/Frameworks/AppKit.framework/Headers/NSCollectionView.h:9:
/Library/Developer/CommandLineTools/SDKs/MacOSX15.5.sdk/System/Library/Frameworks/AppKit.framework/Headers/NSViewController.h:260:39: error: unknown type name 'NSExtensionContext'; did you mean 'NSAnimationContext'?
@property (nullable, readonly,retain) NSExtensionContext *extensionContext API_AVAILABLE(macos(10.10));
^
/Library/Developer/CommandLineTools/SDKs/MacOSX15.5.sdk/System/Library/Frameworks/AppKit.framework/Headers/NSAnimationContext.h:19:12: note: 'NSAnimationContext' declared here
@interface NSAnimationContext : NSObject
^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
20 errors generated.
[13/427] Building CXX object taichi/rhi/common/CMakeFiles/common_rhi.dir/host_memory_pool.cpp.o
ninja: build stopped: subcommand failed.
Traceback (most recent call last):
There was a problem hiding this comment.
actually... that did work, I was building the wrong branch :) I'll make the change
| constexpr int NSEventTypeKeyDown = 10; | ||
| constexpr int NSEventTypeKeyUp = 11; | ||
| constexpr int NSEventTypeFlagsChanged = 12; | ||
| constexpr int NSEventTypeScrollWheel = 22; |
yuhongyi
left a comment
There was a problem hiding this comment.
lgtm, since the renderer will be gone at some point
|
Thanks! |
|
(Note: we will probably remove the UI, but for now, merging this is the lowest hanging fruit for getting mac build working I feel. I don't want to spend time right now looking into how to remove the UI :) ) |
|
Do we have unit test to make sure the GUI is working fine ? Anyway not a big deal if the plan is to remove it. |
|
Thanks! |
Convert MatrixField.to_torch / to_numpy to thin calls into _interop.get_zerocopy_torch / get_zerocopy_numpy. Adds a single _matrix_view_shape() helper that returns (expected_shape, as_vector); both to_torch and to_numpy now go through it instead of duplicating the n / m / keep_dims branching (closes review #13, #14). Same wins as the ScalarField migration: - _zerocopy_cache as cached_property (closes review #17) - automatic registration with pyquadrants.cache_holders (closes #18) - copy=True now zerocopies + clones (closes #15, #16, #21) - to_numpy(copy=False) goes through numpy.from_dlpack directly, no torch round-trip (closes #6) - Apple Metal double-sync via the centralised helpers (closes #1, #22, #23) The redundant reshape after zerocopy stays (DLPack returns the field's flat n-d shape; numpy/torch users expect the matrix dims appended) but it's now in one place per method instead of two.
Issue: #
See https://genesis-ai-company.slack.com/archives/C08UKDR6KGR/p1749077734526669?thread_ts=1749076147.261559&cid=C08UKDR6KGR for context
Pre-requisite for merging #5
Brief Summary
Update cocoa for mac os 15
copilot:summary
Walkthrough
copilot:walkthrough