Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
75 commits
Select commit Hold shift + click to select a range
9329f87
Add indirect_pointer_vector class
jcmosc Feb 2, 2025
9adb975
Add erase to vector and other updates
jcmosc Feb 2, 2025
618f5f3
Add AGUniqueID function
jcmosc Feb 2, 2025
f8de88f
Fix using alignment instead of alignment mask in swift::metadata
jcmosc Feb 2, 2025
c506721
Implement Subgraph
jcmosc Feb 2, 2025
2ab2b82
Implement Graph::update_attribute
jcmosc Feb 5, 2025
7f3bb20
Implement some update methods on Graph
jcmosc Feb 5, 2025
d507895
Implement Graph::remove_node()
jcmosc Feb 5, 2025
5353b20
Implement attribute-related methods in Graph
jcmosc Feb 6, 2025
f70cf2a
Implement indirect attribute methods on Graph
jcmosc Feb 6, 2025
580e379
Implement value methods in Graph
jcmosc Feb 7, 2025
cfab6a8
Implement output methods on Graph
jcmosc Feb 7, 2025
39977c2
Implement Subgraph() and ~Subgraph()
jcmosc Feb 7, 2025
d2fd0c7
Implement Graph::UpdateStack
jcmosc Feb 8, 2025
0e7d048
Fix bug in Subgraph::tree_node_at_index
jcmosc Feb 10, 2025
4e82cb4
Implement input methods in Graph
jcmosc Feb 12, 2025
58c5f2b
Implement Graph::mark_changed
jcmosc Feb 12, 2025
c7a1031
Fix linker errors
jcmosc Feb 12, 2025
9e8946c
Move util namespace to its own target
jcmosc Feb 12, 2025
0d1dc51
Delete ArrayRef::operator new
jcmosc Feb 12, 2025
aecfc02
Implement Graph::Graph and Graph::~Graph()
jcmosc Feb 12, 2025
73bed59
Implement Graph::Context
jcmosc Feb 12, 2025
3575138
Implement Graph::is_context_updating and Graph::main_context
jcmosc Feb 12, 2025
bec1e3f
Implement Encoder
jcmosc Feb 12, 2025
94e5e5c
Add Graph::TraceRecorder and implement some trace methods on Graph
jcmosc Feb 13, 2025
f0c437e
Implement Graph::prepare_trace
jcmosc Feb 13, 2025
ff931ed
Implement remaining trace methods on Graph
jcmosc Feb 13, 2025
98f910f
Implement encode methods on Graph
jcmosc Feb 14, 2025
52518fc
Fix bug in Subgraph::tree_node_at_index
jcmosc Feb 14, 2025
7907b12
Implement profiler methods on Graph
jcmosc Feb 15, 2025
09c2d27
Implement Graph::ProfileTrace
jcmosc Feb 16, 2025
d65ebcf
Implement print methods on Graph
jcmosc Feb 16, 2025
9acc13f
Implement Graph print and description methods
jcmosc Feb 25, 2025
d6200c3
Move tagged pointer to Utilities target
jcmosc Feb 25, 2025
87b5d86
Fix linker errors
jcmosc Feb 25, 2025
fed4ebf
Implement DebugServer class
jcmosc Feb 26, 2025
9125e1d
Add InlineHeap class
jcmosc Feb 26, 2025
8620512
Add ExternalTrace class
jcmosc Feb 26, 2025
2a831ff
Add util::objc_ptr class
jcmosc Feb 26, 2025
025c3f5
Rename flags
jcmosc Feb 26, 2025
cfaba65
Use actual notification names
jcmosc Feb 26, 2025
9451f1c
Remove comment
jcmosc Feb 26, 2025
9e380dc
Rename profile fields
jcmosc Feb 26, 2025
6a4fa34
Move AGValueState
jcmosc Feb 26, 2025
86fda99
Implement remainder of Graph::value_set_internal
jcmosc Feb 26, 2025
9c80c8f
Add AGType enum functions
jcmosc Feb 27, 2025
c4724c6
Add AGGraph... functions
jcmosc Mar 20, 2025
758b0e6
Add AGSubgraph... functions
jcmosc Mar 20, 2025
92c8909
Add AGTreeElement... functions
jcmosc Mar 20, 2025
ec006a9
Finish named events
jcmosc Mar 20, 2025
ce66d3b
Finish cached attributes
jcmosc Mar 20, 2025
7fae962
Fix circular types
jcmosc Mar 20, 2025
a8224ed
Implement Swift code
jcmosc Apr 8, 2025
8784790
Flip page list direction
jcmosc Apr 10, 2025
10ae34b
Add iterators for pages and attributes
jcmosc Apr 10, 2025
94872d9
Move Node::relative_offset out of flags struct
jcmosc Apr 10, 2025
bb78ddb
Flatten fields on Node
jcmosc Apr 10, 2025
9c18e93
Add RelativeAttributeID
jcmosc Apr 11, 2025
55e1b81
Make closure function context first parameter
jcmosc Apr 11, 2025
cd4ed52
Add default implementations for AttributeIDList
jcmosc Apr 11, 2025
de5e10d
Test fixes
jcmosc Apr 11, 2025
966b1e8
DebugServer fixes for util::objc_ptr
jcmosc Apr 11, 2025
b42e9cc
Subgraph fixes for util::cf_ptr
jcmosc Apr 11, 2025
1964fde
Delete duplicate code
jcmosc Apr 11, 2025
7f07c56
Prevent implicit conversion of data::ptr to bool
jcmosc Apr 13, 2025
bc76913
Refine flags property for Swift
jcmosc Apr 24, 2025
8f1db56
Change #include to #import for Objective-C dependencies
jcmosc Apr 24, 2025
49df0b8
Refine info property
jcmosc Apr 24, 2025
c18ab8b
Tests WIP
jcmosc Apr 28, 2025
453c44c
Fix passing Graph and Subgraph to closure
jcmosc May 4, 2025
4ef880d
Ensure unique indices are not zero
jcmosc May 4, 2025
314716f
Fix build warnings
jcmosc May 14, 2025
b8061a2
Make AG::vector non copyable and other code hygiene
jcmosc May 14, 2025
f88cd74
Add layout tests
jcmosc May 14, 2025
bd1f8d5
Merge branch 'main' into latest-with-main
jcmosc May 18, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
68 changes: 68 additions & 0 deletions Compute.xctestplan
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
{
"configurations" : [
{
"id" : "EF776845-F06A-498A-A7EE-EA72E31616F9",
"name" : "Test Scheme Action",
"options" : {

}
}
],
"defaultOptions" : {
"environmentVariableEntries" : [
{
"key" : "AG_PRINT_LAYOUTS",
"value" : "1"
},
{
"key" : "AG_PREFETCH_LAYOUTS",
"value" : "1"
},
{
"key" : "AG_ASYNC_LAYOUTS",
"value" : "0"
}
]
},
"testTargets" : [
{
"skippedTests" : {
"suites" : [
{
"name" : "MetadataTests",
"testFunctions" : [
"description(of:equals:)"
]
}
]
},
"target" : {
"containerPath" : "container:",
"identifier" : "ComputeTests",
"name" : "ComputeTests"
}
},
{
"target" : {
"containerPath" : "container:",
"identifier" : "UtilitiesTests",
"name" : "UtilitiesTests"
}
},
{
"target" : {
"containerPath" : "container:",
"identifier" : "ComputeCxxTests",
"name" : "ComputeCxxTests"
}
},
{
"target" : {
"containerPath" : "container:",
"identifier" : "ComputeCompatibilityTests",
"name" : "ComputeCompatibilityTests"
}
}
],
"version" : 1
}
18 changes: 18 additions & 0 deletions Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,24 @@ let package = Package(
cxxSettings: [.headerSearchPath("")]
),
.target(name: "ComputeCxxSwiftSupport"),
.testTarget(
name: "ComputeCxxTests",
dependencies: ["ComputeCxx"],
cSettings: [
.headerSearchPath("../../Sources/ComputeCxx"),
.unsafeFlags([
"-isystem", "\(swiftProjectPath)/swift/include",
"-isystem", "\(swiftProjectPath)/swift/stdlib/public/SwiftShims",
"-isystem", "\(swiftProjectPath)/swift/stdlib/public/runtime",
"-isystem", "\(swiftProjectPath)/llvm-project/llvm/include",
"-isystem", "\(swiftProjectPath)/llvm-project/clang/include",
"-isystem", "\(swiftProjectPath)/build/Default/swift/include",
"-isystem", "\(swiftProjectPath)/build/Default/llvm/include",
"-isystem", "\(swiftProjectPath)/build/Default/llvm/tools/clang/include",
]),
],
linkerSettings: [.linkedLibrary("swiftDemangle")]
),
],
cxxLanguageStandard: .cxx20
)
82 changes: 35 additions & 47 deletions Sources/Compute/Attribute/AnyAttribute.swift
Original file line number Diff line number Diff line change
@@ -1,96 +1,84 @@
import ComputeCxx

public struct InputOptions {}

public struct SearchOptions {}

public struct AttributeFlags {}

extension AnyAttribute {

public static var current: AnyAttribute? {
fatalError("not implemented")
let attribute = __AGGraphGetCurrentAttribute()
return attribute == .nil ? nil : attribute
}

public init<Value>(_ attribute: Attribute<Value>) {
fatalError("not implemented")
self = attribute.identifier
}

public func unsafeOffset(at offset: Int) -> AnyAttribute {
fatalError("not implemented")
// TODO: swift Int instead of UInt32
return __AGGraphCreateOffsetAttribute(self, UInt32(offset))
}

public func unsafeCast<Value>(to type: Value.Type) -> Attribute<Value> {
fatalError("not implemented")
}

public var _bodyType: Any.Type {
fatalError("not implemented")
}

public var _bodyPointer: UnsafeRawPointer {
fatalError("not implemented")
return Attribute<Value>(identifier: self)
}

public func visitBody<Visitor: AttributeBodyVisitor>(_ visitor: inout Visitor) {
fatalError("not implemented")
let type = info.type.pointee.typeID.type as! _AttributeBody.Type
type._visitSelf(info.body, visitor: &visitor)
}

public func mutateBody<Body>(as type: Body.Type, invalidating: Bool, _ mutator: (inout Body) -> Void) {
fatalError("not implemented")
}

public func breadthFirstSearch(options: SearchOptions, _ predicate: (AnyAttribute) -> Bool) -> Bool {
fatalError("not implemented")
Graph.mutateAttribute(self, type: Metadata(type), invalidating: invalidating) { pointer in
mutator(&pointer.assumingMemoryBound(to: Body.self).pointee)
}
}

public var valueType: Any.Type {
fatalError("not implemented")
public func breadthFirstSearch(options: AGSearchOptions, _ predicate: (AnyAttribute) -> Bool) -> Bool {
return Graph.search(attribute: self, options: options, predicate: predicate)
}

public func setFlags(_ newFlags: AttributeFlags, mask: AttributeFlags) {
fatalError("not implemented")
public func setFlags(_ newFlags: AGAttributeFlags, mask: AGAttributeFlags) {
flags = flags.subtracting(mask).union(newFlags.intersection(mask))
}

public func addInput(_ input: AnyAttribute, options: InputOptions, token: Int) {
fatalError("not implemented")
public func addInput(_ input: AnyAttribute, options: AGInputOptions, token: Int) {
__AGGraphAddInput(self, input, options)
}

public func addInput<T>(_ input: Attribute<T>, options: InputOptions, token: Int) {
fatalError("not implemented")
public func addInput<T>(_ input: Attribute<T>, options: AGInputOptions, token: Int) {
addInput(input.identifier, options: options, token: token)
}

public var indirectDependency: AnyAttribute? {
get {
fatalError("not implemented")
let indirectDependency = __AGGraphGetIndirectDependency(self)
return indirectDependency == .nil ? nil : indirectDependency
}
set {
fatalError("not implemented")
__AGGraphSetIndirectDependency(self, newValue ?? .nil)
}
}

}
public var _bodyType: Any.Type {
return info.type.pointee.typeID.type
}

extension AnyAttribute: @retroactive CustomStringConvertible {
public var _bodyPointer: UnsafeRawPointer {
return info.body
}

public var description: String {
fatalError("not implemented")
public var valueType: Any.Type {
return info.type.pointee.valueTypeID.type
}

}

extension AnyAttribute: @retroactive Equatable {
extension AnyAttribute: @retroactive CustomStringConvertible {

public static func == (_ lhs: AnyAttribute, _ rhs: AnyAttribute) -> Bool {
fatalError("not implemented")
public var description: String {
return "#\(rawValue)"
}

}

extension AnyAttribute: @retroactive Hashable {
extension AnyAttribute: @retroactive Equatable {}

public func hash(into hasher: inout Hasher) {
fatalError("not implemented")
}

}
extension AnyAttribute: @retroactive Hashable {}
Loading