How to test -assume-single-threaded option?


(Jiho Choi) #1

Hi,

I want to try -assume-single-threaded option to measure the overhead of
atomic operations for reference counting. However, it seems that the
option works as intended with the frontend but not with the driver. In
other words, I tried two commands below, and only the first command
replaced atomic operations.

swiftc -frontend -emit-sil -assume-single-threaded mytest.swift
swiftc -emit-sil -assume-single-threaded mytest.swift

Is the option disabled for the driver for some reason?

Thanks,
Jiho


(Slava Pestov) #2

Hi Jiho,

Some low-level frontend flags are not exposed to the driver.

To pass frontend flags directly via the driver, use -Xfrontend, eg

swiftc -Xfrontend -assume-single-threaded mytest.swift

This is different from -frontend — -frontend skips the driver entirely, -Xfrontend runs the driver but passes the next argument to each frontend invocation.

Slava

···

On Jan 13, 2017, at 1:01 PM, Jiho Choi via swift-dev <swift-dev@swift.org> wrote:

Hi,

I want to try -assume-single-threaded option to measure the overhead of atomic operations for reference counting. However, it seems that the option works as intended with the frontend but not with the driver. In other words, I tried two commands below, and only the first command replaced atomic operations.

swiftc -frontend -emit-sil -assume-single-threaded mytest.swift
swiftc -emit-sil -assume-single-threaded mytest.swift

Is the option disabled for the driver for some reason?

Thanks,
Jiho
_______________________________________________
swift-dev mailing list
swift-dev@swift.org
https://lists.swift.org/mailman/listinfo/swift-dev


(Jordan Rose) #3

<disclaimer>For anyone following along, frontend flags are not guaranteed to be stable (as in, they may be removed in a later version of Swift), nor are they guaranteed to produce correct or working code. Jiho’s use is exactly the correct one—to check for a difference of behavior in the Swift compiler itself—but please do not use these in production code.</disclaimer>

Jordan

···

On Jan 13, 2017, at 13:50, Slava Pestov via swift-dev <swift-dev@swift.org> wrote:

Hi Jiho,

Some low-level frontend flags are not exposed to the driver.

To pass frontend flags directly via the driver, use -Xfrontend, eg

swiftc -Xfrontend -assume-single-threaded mytest.swift

This is different from -frontend — -frontend skips the driver entirely, -Xfrontend runs the driver but passes the next argument to each frontend invocation.

Slava

On Jan 13, 2017, at 1:01 PM, Jiho Choi via swift-dev <swift-dev@swift.org> wrote:

Hi,

I want to try -assume-single-threaded option to measure the overhead of atomic operations for reference counting. However, it seems that the option works as intended with the frontend but not with the driver. In other words, I tried two commands below, and only the first command replaced atomic operations.

swiftc -frontend -emit-sil -assume-single-threaded mytest.swift
swiftc -emit-sil -assume-single-threaded mytest.swift

Is the option disabled for the driver for some reason?

Thanks,
Jiho
_______________________________________________
swift-dev mailing list
swift-dev@swift.org
https://lists.swift.org/mailman/listinfo/swift-dev

_______________________________________________
swift-dev mailing list
swift-dev@swift.org
https://lists.swift.org/mailman/listinfo/swift-dev


(Slava Pestov) #4

<disclaimer>For anyone following along, frontend flags are not guaranteed to be stable (as in, they may be removed in a later version of Swift), nor are they guaranteed to produce correct or working code. Jiho’s use is exactly the correct one—to check for a difference of behavior in the Swift compiler itself—but please do not use these in production code.</disclaimer>

Jordan

This is swift-dev, not swift-users, so I’m assuming anything goes, even questions about SIL syntax :slight_smile:

···

On Jan 13, 2017, at 1:58 PM, Jordan Rose <jordan_rose@apple.com> wrote:

On Jan 13, 2017, at 13:50, Slava Pestov via swift-dev <swift-dev@swift.org> wrote:

Hi Jiho,

Some low-level frontend flags are not exposed to the driver.

To pass frontend flags directly via the driver, use -Xfrontend, eg

swiftc -Xfrontend -assume-single-threaded mytest.swift

This is different from -frontend — -frontend skips the driver entirely, -Xfrontend runs the driver but passes the next argument to each frontend invocation.

Slava

On Jan 13, 2017, at 1:01 PM, Jiho Choi via swift-dev <swift-dev@swift.org> wrote:

Hi,

I want to try -assume-single-threaded option to measure the overhead of atomic operations for reference counting. However, it seems that the option works as intended with the frontend but not with the driver. In other words, I tried two commands below, and only the first command replaced atomic operations.

swiftc -frontend -emit-sil -assume-single-threaded mytest.swift
swiftc -emit-sil -assume-single-threaded mytest.swift

Is the option disabled for the driver for some reason?

Thanks,
Jiho
_______________________________________________
swift-dev mailing list
swift-dev@swift.org
https://lists.swift.org/mailman/listinfo/swift-dev

_______________________________________________
swift-dev mailing list
swift-dev@swift.org
https://lists.swift.org/mailman/listinfo/swift-dev